BankUpdateView.xaml.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Muchinfo.MTPClient.Bank.ViewModels;
  2. using System.Windows;
  3. using System.Windows.Input;
  4. namespace Muchinfo.MTPClient.Bank.Views
  5. {
  6. /// <summary>
  7. /// BankUpdateView.xaml 的交互逻辑
  8. /// </summary>
  9. public partial class BankUpdateView : Window
  10. {
  11. public BankUpdateView()
  12. {
  13. InitializeComponent();
  14. this.DataContext = new BankUpdateViewModel(this);
  15. }
  16. private void NewBankAccountTextBox_OnKeyDown(object sender, KeyEventArgs e)
  17. {
  18. if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9))
  19. {
  20. e.Handled = false;
  21. }
  22. else
  23. {
  24. e.Handled = true;
  25. }
  26. }
  27. private void NewBankAccountConfirmTextBox_OnKeyDown(object sender, KeyEventArgs e)
  28. {
  29. if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9))
  30. {
  31. e.Handled = false;
  32. }
  33. else
  34. {
  35. e.Handled = true;
  36. }
  37. }
  38. /// <summary>
  39. /// 禁用Ctrl+V粘贴
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
  44. {
  45. if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.V)
  46. {
  47. e.Handled = true;
  48. }
  49. }
  50. }
  51. }