Sometimes is useful disable the cut, copy and paste functions.

Here how to do it in WPF.
Here the xaml with the parameter extBox CommandManager.PreviewExecuted=“textBox_PreviewExecuted”/>

<TextBox CommandManager.PreviewExecuted="textBox_PreviewExecuted"/>

And here the binded fuction:

private void textBox_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
{
	if (e.Command == ApplicationCommands.Copy ||
    	e.Command == ApplicationCommands.Cut  ||
    	e.Command == ApplicationCommands.Paste)
	{
		e.Handled = true;
	}
}
Advertisements