Approved
Last Updated: 02 Mar 2017 09:48 by ADMIN
ADMIN
Boby
Created on: 02 Mar 2017 09:48
Category: RichTextBox
Type: Feature Request
0
RichTextBox: Enhance clipboard handlers API and use them for Copy operation
Currently the API allows ClipboardHandler-s to be registered in ClipboardEx.ClipboardHandlers collection, which is used when content is pasted. 
We can extend ClipboardHandler with property describing whether the handler is supported for copy, paste, or copy&paste, and use the collection for copy operation as well.

Workaround: Use RadRichTextBox.CommandExecuted and on copy, enhance the original data object in the clipboard:

            this.radRichTextBox.CommandExecuted += (sender, e) =>
            {
                if (e.Command is CopyCommand)
                {
                    var originalDataObject = Clipboard.GetDataObject();

                    DataObject dataObject = new DataObject();
                    foreach (string format in originalDataObject.GetFormats())
                    {
                        dataObject.SetData(format, originalDataObject.GetData(format));
                    }

                    dataObject.SetData("Html", new HtmlFormatProvider().Export(this.radRichTextBox.Document));

                    Clipboard.SetDataObject(dataObject);
                }
            };
0 comments