How to suppress Cut, Copy and Paste Operations in TextBox in WPF? -


I want to suppress the cut, copy and paste operations in the text box.

I do not want any of these functions from the user's default context menu in the text box or in the text box.

Please tell me how can I restrict these tasks?

You can do this very easily using command managers. PreviewAexecuted root event. In your XAML, you will enter the following on your textbox element. It will be applicable to CTL + V, etc. along with context menus or any button that you have mapped with those commands, so this is very effective.

  & lt; Text Box Commandmanager PreviewCanxText = "HandLexExtact" / & gt;  

Then in your code-behind, add a handlineconexcept method, which disables the command.

  Private Zero HandXXsecute (Object Sender, CanExecuteRoutedEventArgs e) {if (e.command == Application Commands.Cut || E.Command == Application Commands.Copy || E.Command == Application Commands.paste) {E.CanXicute = False; E.Handled = True; }}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -