texbox disable copy paster cut

<TextBox CommandManager.PreviewExecuted="textBox_PreviewExecuted"
         ContextMenu="{x:Null}" />

in above textbox code we can restrict these commands in PrviewExecuted event of CommandManager Class

and in code behind add below code and your job is done

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324653064&siteId=291194637
cut