在wp8中禁用TextBox中的复制和粘贴

时间:2013-07-23 06:14:12

标签: c# windows-phone-8 copy-paste

我正在使用c#开发一个Windows Phone 8应用程序,我试图在TextBox中禁用复制和粘贴。 任何人都可以提供帮助。

我试过了:

private void digitBox_KeyDown(object sender, KeyEventArgs e)
{ 
   if (e.Key == (Key.Ctrl | Key.V) ) 
   { 
       e.Handled = true; 
       digitBox.SelectionLength = 0; 
    } 
} 

thanx

1 个答案:

答案 0 :(得分:2)

private void textBox1_KeyDown(object sender, KeyEventArgs e)
  {
   if (e.Modifiers == Keys.Control)
   {
     e.Handled = true;
    textBox1.SelectionLength = 0;
   }
  }