Hi all,
I've got a requirement to modify the styling of rich text that's pasted into my radrichtextbox. The following code works, but it hangs the UI when it's run on the main thread, and ClipboardEx.GetDocumentFromClipboard is unhappy when it's not run on the main thread ( something like this https://stackoverflow.com/questions/15913275/backgroundworker-and-clipboard )
Has anybody found a way around this?
private void EditorTextBoxCommandExecuting(object sender, CommandExecutingEventArgs e)
{
if (e.Command is PasteCommand)
{
DocumentFragment fragment = ClipboardEx
.GetDocumentFromClipboard(
"RadDocumentGUID"); //copy pasting from a RadRichTextBox, keep the paragraphs as they are
RemoveStylingFromFragment(fragment);
Editor.InsertFragment(fragment);
}
}