Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

This is how you can disable paste in TextBoxes in WPF

View MainWindow.xaml
1 2 3 4 5 6 7 8
<Window x:Class="WpfApplication9.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBox Name="MyTextBox" Text="Hello" />
</Grid>
</Window>
View MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11
public MainWindow()
{
InitializeComponent();
 
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
Something went wrong with that request. Please try again.