using Muchinfo.MTPClient.Bank.ViewModels; using System.Windows; using System.Windows.Input; namespace Muchinfo.MTPClient.Bank.Views { /// /// BankUpdateView.xaml 的交互逻辑 /// public partial class BankUpdateView : Window { public BankUpdateView() { InitializeComponent(); this.DataContext = new BankUpdateViewModel(this); } private void NewBankAccountTextBox_OnKeyDown(object sender, KeyEventArgs e) { if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9)) { e.Handled = false; } else { e.Handled = true; } } private void NewBankAccountConfirmTextBox_OnKeyDown(object sender, KeyEventArgs e) { if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9)) { e.Handled = false; } else { e.Handled = true; } } /// /// 禁用Ctrl+V粘贴 /// /// /// private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e) { if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.V) { e.Handled = true; } } } }