WPF密码框中禁止复制、粘贴

如题:

    //前台代码
     <PasswordBox x:Name="txtPwd" Height="25" Width="222" FontSize="15" Margin="215,32,151,0" > <PasswordBox.CommandBindings> <CommandBinding Command="ApplicationCommands.Paste" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/> </PasswordBox.CommandBindings> </PasswordBox> //后台代码 private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { } private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.Handled = true; }

 

posted @ 2016-07-06 15:47  蕤颜  阅读(1192)  评论(0编辑  收藏  举报