I'm trying to intercept the paste event when the user has pressed control -v, to paste the clipboard contents as plain text.
But I can't work out where to start ?
Thanks
Euan
1 Answer, 1 is accepted
0
Accepted
Dimitar
Telerik team
answered on 28 Oct 2013, 07:17 AM
Hi Euan,
Thank you for writing.
To intercept and change the default behaviour of the Ctrl+V key combination you can use the following custom InputBehavior class:
class MyInputBeaviour : InputBehavior
{
public MyInputBeaviour(DocumentView view) : base(view)
document.Insert((string)Clipboard.GetData("Text"), new StyleDefinition());
e.SuppressKeyPress = true;
return false;
}
else
{
return base.ProcessKeyDownCore(e);
}
}
}
Then you just need to change the default behaviour with the new one:
radRichTextBox1.RichTextBoxElement.ViewElement.DocumentView.InputBehavior = new MyInputBeaviour(doc.DocumentView);
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely. Sign up for Free application insights >>