加载时:

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //控件名称
            //事件名称
            DataObject.AddPastingHandler(textBox2, TextBoxPlus_PastingEvent);
        }

事件:

  

 private void TextBoxPlus_PastingEvent(object sender, DataObjectPastingEventArgs e)
        {
            if (e.DataObject.GetDataPresent(typeof(String)))
            {
                String pastingText = (String)e.DataObject.GetData(typeof(String));
                e.CancelCommand();
            }
            
            
        }

 

posted on 2014-03-18 23:16  L875155279  阅读(1666)  评论(0编辑  收藏  举报