Skip to content

@PaulStovell /MainWindow.xaml
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
This is how you can disable paste in TextBoxes in WPF
<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>
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.