views:

1439

answers:

1

How can I disable the copy and paste functionality in a Silverlight textblock?

+4  A: 

I will assume that you mean TextBox rather than TextBlock as the latter doesn't provide cut and paste.

I think the easiest way to do this will be to derive from TextBox and override the key handling to prevent clipboard operation shortcuts. You would need to extend this basic solution if you wanted I18N support to allow for different shortcuts on different systems, but for the standard Ctrl+V, Ctrl+C (or Apple+C and Apple+V on Macs), this should work. You may also want to consider Ctrl+Ins as an alternative to Ctrl+V (I'm not certain Silverlight supports this, but it might).

Jeff Yates