We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Disable copy/paste from the RichTextBoxAdv control

I am looking for a way to disable the ability to copy and paste from the SfRichTextBoxAdv control. Is there a way to explicitly do this?

Or alternatively, is there a way to disable selection so that copy can't be performed?

Thanks!

3 Replies

GT Gunasekaran T Syncfusion Team January 21, 2014 09:10 AM UTC

Hi Timothy,

Thank you for your interest in Syncfusion products.

In SfRichTextBoxAdv control it is not possible to specifically disable copy/paste or selection functionality. Instead we can disable entire edit (Including copy/paste) functionality by setting IsReadOnly property to true. Please do find the code snippet to set IsReadOnly property from below.

Code Snippet:
[XAML]
<syncfusion:SfRichTextBoxAdv x:Name="richTextBoxAdv" IsReadOnly="True" ManipulationMode="All" />

[C#]
richTextBoxAdv.IsReadOnly = true;

Please let us know if you have any other questions.

Regards,
Gunasekaran



TJ Timothy J Eicher January 21, 2014 04:44 PM UTC

Thanks for the reply!
Setting IsReadOnly to True has not disabled copy/paste for me. I can still select text, and use Ctrl-C to copy and paste the text to another location.
I've been able to find a solution that locks down copy/paste from keyboard events, but it would be nice if it could be explicitly disabled from the control.


GT Gunasekaran T Syncfusion Team January 23, 2014 06:20 AM UTC

Hi Timothy,

Thank you for your update.

Regarding “Setting IsReadOnly to True has not disabled copy/paste for me”:
In general setting IsReadOnly to true will disable only the edit functionality within the particular control (Cut/Paste content in to control will be disabled), and copy functionality will work as normal, since copying selected content to system Clipboard does not lead to any edit operation within the control. This behavior is common to all Text box control and the same behavior is implemented in SfRichTextBoxAdv control.

In order to disable Copy/Cut/Paste option from keyboard events in SfRichTextBoxAdv control, we can create a custom control inheriting SfRichTextBoxAdv and override the KeyDown events to disable Copy/Cut/Paste operations explicitly. Please do find the sample for the same from attachment.

Please let us know if you have any other questions.

Regards,
Gunasekaran



SfRichTextBoxAdvSample_757ce2da.zip

Loader.
Live Chat Icon For mobile
Up arrow icon