I am trying to disable Copy/Paste/Cut feature in special window in xaml(WPF)
.
I set the PreviewKeyDown="Window_PreviewKeyDown"
in properties of special window. This way any key down it will track and cancel. Below code is working fine for disallow copy & paste for outside.
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
{
if(Keyboard.Modifiers == ModifierKeys.Control && (e.Key == Key.C || e.Key == Key.X))
{
e.Handled = true;
}
if(Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.V)
{
e.Handled = true;
}
}
This works
Now, I would like to allow copying and pasting from within the application itself.
Is there a way to disallow outside copy pasting into an application except for what has been copied and pasted from with an application?