Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable shortcuts in WPF TextBox

I want to disable all default shortcuts in WPF TextBox. Shortcuts like Ctrl + A, Ctrl + V, Ctrl + C etc. Can this be done?. It looks to me that these shortcuts are executed before KeyDown event

like image 349
Sergej Andrejev Avatar asked Mar 22 '09 15:03

Sergej Andrejev


1 Answers

You can intercept the keystrokes in the PreviewKeyDown event. Set the e.Handled member to true and that will prevent the actually processing of the keys.

like image 170
JaredPar Avatar answered Sep 24 '22 09:09

JaredPar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!