Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
This is how you can disable paste in TextBoxes in WPF
<Window x:Class="WpfApplication9.MainWindow"
Title="MainWindow" Height="350" Width="525">
<TextBox Name="MyTextBox" Text="Hello" />
public MainWindow()
MyTextBox.CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, Foo));
private void Foo(object sender, ExecutedRoutedEventArgs e)
e.Handled = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment