找回密码
 立即注册
首页 业界区 业界 WPF+MVVM入门学习

WPF+MVVM入门学习

赶塑坠 2025-9-28 18:27:43
最近在学WPF的MVVM,有两种方式实现,一种是自己实现,一种是借助MVVM框架,接下来通过一个医院自助打印报告机键盘输入界面来演示自己实现、框架CommunityToolkit和Prism的区别。
项目源码:https://gitee.com/cplmlm/SelfServiceReportPrinter
https://github.com/cplmlm/SelfServiceReportPrinter
推荐学习博主:B站UP十月的寒流
一、自己实现

1、首先我们创建一个BaseNotifyPropertyChanged类,继承INotifyPropertyChanged,这个方法的作用是属性值变化时自动更新UI界面。
  1. public class BaseNotifyPropertyChanged : INotifyPropertyChanged
  2. {
  3. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  4. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  5. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  6. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  7. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  8. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  9. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public event PropertyChangedEventHandler? PropertyChanged;
  10. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public void RaisePropertyChanged(string propertyName)
  17. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  18. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  19. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  20. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  21. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  22. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  23. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  24. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  25. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  26. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  27. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  28. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  29. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  30. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  31. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  32. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  33. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  34. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  35. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  36. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> if (!string.IsNullOrEmpty(propertyName))
  37. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  44. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  45. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  46. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  47. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  48. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  49. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  50. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  51. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  52. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  53. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  54. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  55. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  56. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  57. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  58. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  59. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  60. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  61. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  62. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  63. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  64. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  65. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  66. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  67. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  68. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  69. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  70. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  71. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  72. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  73. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  74. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  75. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  76. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  77. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  78. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  79. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  80. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  81. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  82. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  83. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  84. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  85. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  86. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  87. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  88. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  89. }
复制代码
2、创建一个KeyPressViewModel类,继承BaseNotifyPropertyChanged。
  1. public class KeyPressViewModel : BaseNotifyPropertyChanged
  2. {
  3. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  4. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  5. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  6. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  7. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  8. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  9. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private string cardNumber;
  10. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private int selectionStart=0;
  17. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  18. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  19. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  20. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  21. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  22. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  23. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  24. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  25. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  26. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  27. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  28. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  29. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  30. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 输入文本框的值
  31. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  38. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  39. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  40. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  41. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  42. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  43. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  44. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public string CardNumber
  45. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  46. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  47. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  48. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  49. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  50. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  51. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  52. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> get { return cardNumber; }
  65. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  66. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  67. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  68. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  69. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  70. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  71. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  72. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  73. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  74. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  75. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  76. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  77. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> set
  78. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  79. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  80. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  81. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  82. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  83. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  84. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  85. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  86. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  87. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  88. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  89. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  90. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  91. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  92. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  93. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  94. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  95. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  96. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  97. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> cardNumber = value;
  110. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  111. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  112. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  113. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  114. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  115. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  116. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  117. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  118. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  119. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  120. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  121. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  122. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  123. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  124. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  125. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  126. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  127. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  128. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> RaisePropertyChanged(nameof(CardNumber));
  129. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  130. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  131. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  132. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  133. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  134. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  135. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  136. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  137. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  138. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  139. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  140. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  141. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  142. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  143. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  144. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  145. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  146. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  147. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  148. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  149. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  150. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  151. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  152. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  153. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  154. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  155. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  156. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  157. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  158. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  159. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  160. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  161. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  162. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 输入框光标位置
  163. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  164. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  165. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  166. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  167. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  168. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  169. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  170. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  171. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  172. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  173. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  174. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  175. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  176. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public int SelectionStart
  177. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  178. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  179. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  180. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  181. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  182. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  183. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  184. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  185. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  186. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  187. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  188. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  189. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  190. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  191. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  192. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  193. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  194. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  195. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  196. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> get { return selectionStart; }
  197. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  198. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  199. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  200. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  201. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  202. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  203. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  204. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  205. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  206. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  207. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  208. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  209. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> set { RaisePropertyChanged(nameof(SelectionStart)); }
  210. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  211. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  212. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  213. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  214. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  215. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  216. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  217. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  218. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  219. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  220. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  221. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  222. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  223. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  224. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  225. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  226. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  227. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  228. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  229. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  230. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 数字按钮绑定事件
  231. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  232. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  233. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  234. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  235. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  236. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  237. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  238. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  239. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  240. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  241. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  242. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  243. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  244. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public ICommand NumberCommand
  245. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  246. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  247. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  248. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  249. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  250. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  251. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  252. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  253. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  254. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  255. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  256. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  257. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  258. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  259. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  260. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  261. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  262. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  263. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  264. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> get { return new RelayCommand<string>(Number); }
  265. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  266. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  267. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  268. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  269. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  270. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  271. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  272. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  273. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  274. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  275. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  276. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  277. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  278. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  279. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  280. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  281. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  282. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  283. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  284. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  285. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 清空按钮绑定事件
  286. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  287. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  288. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  289. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  290. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  291. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  292. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  293. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  294. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  295. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  296. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  297. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  298. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  299. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public ICommand ClearCommand
  300. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  301. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  302. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  303. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  304. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  305. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  306. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  307. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  308. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  309. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  310. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  311. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  312. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  313. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  314. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  315. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  316. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  317. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  318. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  319. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> get { return new RelayCommand(Clear); }
  320. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  321. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  322. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  323. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  324. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  325. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  326. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  327. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  328. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  329. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  330. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  331. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  332. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  333. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  334. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  335. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  336. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  337. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  338. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  339. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  340. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 删除按钮绑定事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  341. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  342. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  343. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  344. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  345. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  346. <Button  Content="清空"  Command="{Binding ClearCommand}"   />
  347. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  348. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  349. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  350. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  351. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  352. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  353. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  354. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  355. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  356. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  357. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  358. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  359. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  360. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public ICommand DeleteCommand
  361. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  362. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  363. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  364. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  365. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  366. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  367. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  368. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  369. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  370. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  371. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  372. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  373. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  374. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  375. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  376. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  377. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  378. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  379. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  380. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> get { return new RelayCommand(Delete); }
  381. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  382. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  383. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  384. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  385. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  386. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  387. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  388. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  389. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  390. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  391. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  392. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  393. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  394. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  395. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  396. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  397. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  398. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  399. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  400. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  401. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 数字点击事件
  402. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  403. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  404. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  405. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  406. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  407. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  408. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  409. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  410. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  411. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  412. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  413. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  414. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  415. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <param name="key"></param>
  416. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  417. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  418. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  419. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  420. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  421. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  422. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Number(string? key)
  423. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  424. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  425. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  426. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  427. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  428. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  429. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  430. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  431. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  432. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  433. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  434. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  435. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  436. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  437. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  438. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  439. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  440. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  441. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  442. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> CardNumber += key;
  443. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  444. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  445. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  446. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  447. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  448. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  449. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  450. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  451. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  452. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  453. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  454. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  455. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  456. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  457. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  458. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  459. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  460. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  461. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  462. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  463. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 清空点击事件
  464. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  465. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  466. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  467. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  468. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  469. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  470. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  471. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  472. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  473. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  474. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  475. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  476. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  477. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Clear()
  478. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  479. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  480. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  481. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  482. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  483. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  484. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  485. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  486. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  487. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  488. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  489. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  490. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  491. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  492. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  493. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  494. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  495. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  496. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  497. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> CardNumber = string.Empty;
  498. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  499. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  500. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  501. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  502. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  503. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  504. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  505. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  506. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  507. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  508. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  509. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  510. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  511. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// <summary>
  512. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  513. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  514. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  515. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  516. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  517. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  518. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 删除点击事件
  519. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  520. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  521. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  522. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  523. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  524. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  525. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// </summary>
  526. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  527. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  528. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  529. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  530. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  531. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  532. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Delete()
  533. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  534. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  535. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  536. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  537. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  538. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  539. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  540. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  541. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  542. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  543. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  544. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  545. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  546. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  547. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  548. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  549. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  550. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  551. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  552. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> // 光标在输入框时,删除光标前一个字符
  553. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  554. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  555. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  556. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  557. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  558. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  559. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  560. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  561. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  562. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  563. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  564. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  565. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> if (!string.IsNullOrEmpty(CardNumber) && SelectionStart > 0)
  566. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  567. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  568. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  569. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  570. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  571. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  572. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  573. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  574. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  575. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  576. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  577. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  578. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  579. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  580. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  581. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  582. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  583. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  584. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  585. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  586. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  587. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  588. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  589. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  590. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  591. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  592. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  593. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  594. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  595. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  596. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  597. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> CardNumber = CardNumber.Remove(SelectionStart - 1, 1);
  598. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  599. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  600. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  601. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  602. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  603. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  604. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  605. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  606. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  607. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  608. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  609. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  610. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  611. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  612. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  613. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  614. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  615. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  616. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  617. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  618. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  619. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  620. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  621. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  622. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  623. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> //光标没有在输入框时,删除最后一个字符
  624. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  625. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  626. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  627. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  628. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  629. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  630. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  631. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  632. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  633. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  634. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  635. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  636. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> if (SelectionStart == 0)
  637. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  638. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  639. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  640. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  641. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  642. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  643. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  644. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  645. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  646. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  647. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  648. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  649. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {
  650. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  651. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  652. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  653. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  654. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  655. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  656. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  657. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  658. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  659. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  660. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  661. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  662. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  663. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  664. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  665. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  666. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  667. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  668. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> CardNumber = CardNumber.Remove(CardNumber.Length - 1, 1);
  669. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  670. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  671. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  672. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  673. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  674. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  675. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  676. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  677. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  678. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  679. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  680. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  681. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  682. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  683. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  684. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  685. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  686. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  687. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  688. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> }
  689. }
复制代码
3、创建RelayCommand类,这个类的作用是绑定事件的操作,一个泛型版本,一个是非泛型。
  1. public class RelayCommand : ICommand
  2. {
  3. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  4. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  5. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  6. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  7. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  8. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  9. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private Action _execute;
  10. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private Func<bool> _canExecute;
  17. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  18. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  19. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  20. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  21. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  22. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  23. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public RelayCommand(Action execute) : this(execute, null)
  24. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  25. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  26. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  27. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  28. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  29. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  30. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  31. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  38. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  39. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  40. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  41. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  42. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  43. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  44. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public RelayCommand(Action execute, Func<bool> canExecute)
  45. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  46. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  47. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  48. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  49. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  50. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  51. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  52. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (execute == null)
  65. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  66. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  67. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  68. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  69. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  70. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  71. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  72. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  73. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  74. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  75. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  76. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  77. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  78. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  79. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  80. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  81. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  82. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  83. <Button  Content="清空"  Command="{Binding ClearCommand}"   />throw new ArgumentNullException("execute");
  84. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  85. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  86. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  87. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  88. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  89. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  90. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  91. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  92. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  93. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  94. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  95. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  96. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_execute = execute;
  97. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_canExecute = canExecute;
  110. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  111. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  112. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  113. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  114. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  115. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  116. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  117. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  118. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  119. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  120. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  121. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  122. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  123. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public event EventHandler? CanExecuteChanged
  124. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  125. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  126. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  127. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  128. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  129. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  130. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  131. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  132. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  133. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  134. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  135. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  136. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  137. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  138. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  139. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  140. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  141. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  142. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  143. <Button  Content="清空"  Command="{Binding ClearCommand}"   />add
  144. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  145. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  146. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  147. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  148. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  149. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  150. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  151. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  152. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  153. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  154. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  155. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  156. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  157. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  158. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  159. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  160. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  161. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  162. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  163. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  164. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  165. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  166. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  167. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  168. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  169. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  170. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  171. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  172. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  173. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  174. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  175. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (_canExecute != null)
  176. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  177. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  178. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  179. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  180. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  181. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  182. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  183. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  184. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  185. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  186. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  187. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  188. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  189. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  190. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  191. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  192. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  193. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  194. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  195. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  196. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  197. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  198. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  199. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  200. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  201. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  202. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  203. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  204. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  205. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  206. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  207. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  208. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  209. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  210. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  211. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  212. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  213. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  214. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  215. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  216. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  217. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  218. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  219. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CommandManager.RequerySuggested += value;
  220. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  221. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  222. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  223. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  224. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  225. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  226. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  227. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  228. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  229. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  230. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  231. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  232. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  233. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  234. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  235. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  236. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  237. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  238. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  239. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  240. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  241. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  242. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  243. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  244. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  245. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  246. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  247. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  248. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  249. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  250. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  251. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  252. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  253. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  254. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  255. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  256. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  257. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  258. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  259. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  260. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  261. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  262. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  263. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  264. <Button  Content="清空"  Command="{Binding ClearCommand}"   />remove
  265. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  266. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  267. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  268. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  269. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  270. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  271. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  272. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  273. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  274. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  275. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  276. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  277. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  278. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  279. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  280. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  281. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  282. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  283. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  284. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  285. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  286. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  287. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  288. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  289. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  290. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  291. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  292. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  293. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  294. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  295. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  296. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (_canExecute != null)
  297. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  298. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  299. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  300. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  301. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  302. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  303. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  304. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  305. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  306. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  307. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  308. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  309. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  310. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  311. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  312. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  313. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  314. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  315. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  316. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  317. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  318. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  319. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  320. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  321. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  322. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  323. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  324. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  325. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  326. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  327. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  328. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  329. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  330. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  331. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  332. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  333. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  334. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  335. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  336. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  337. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  338. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  339. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  340. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CommandManager.RequerySuggested -= value;
  341. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  342. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  343. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  344. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  345. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  346. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  347. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  348. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  349. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  350. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  351. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  352. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  353. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  354. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  355. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  356. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  357. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  358. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  359. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  360. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  361. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  362. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  363. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  364. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  365. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  366. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  367. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  368. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  369. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  370. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  371. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  372. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  373. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  374. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  375. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  376. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  377. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  378. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  379. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  380. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  381. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  382. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  383. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  384. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  385. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  386. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public bool CanExecute(object parameter)
  387. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  388. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  389. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  390. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  391. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  392. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  393. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  394. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  395. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  396. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  397. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  398. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  399. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  400. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  401. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  402. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  403. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  404. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  405. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  406. <Button  Content="清空"  Command="{Binding ClearCommand}"   />return _canExecute == null ? true : _canExecute();
  407. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  408. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  409. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  410. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  411. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  412. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  413. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  414. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  415. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  416. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  417. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  418. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  419. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  420. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public void Execute(object parameter)
  421. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  422. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  423. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  424. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  425. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  426. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  427. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  428. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  429. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  430. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  431. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  432. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  433. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  434. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  435. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  436. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  437. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  438. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  439. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  440. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_execute();
  441. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  442. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  443. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  444. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  445. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  446. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  447. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  448. }
复制代码
  1. public class RelayCommand<T> : ICommand
  2. {
  3. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  4. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  5. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  6. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  7. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  8. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  9. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private readonly Predicate<T> _canExecute;
  10. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private readonly Action<T> _execute;
  17. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  18. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  19. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  20. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  21. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  22. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  23. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public RelayCommand(Action<T> execute) : this(execute, null)
  24. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  25. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  26. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  27. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  28. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  29. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  30. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  31. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  38. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  39. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  40. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  41. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  42. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  43. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  44. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public RelayCommand(Action<T> execute, Predicate<T> canExecute)
  45. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  46. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  47. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  48. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  49. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  50. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  51. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  52. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (execute == null)
  65. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  66. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  67. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  68. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  69. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  70. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  71. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  72. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  73. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  74. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  75. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  76. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  77. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  78. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  79. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  80. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  81. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  82. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  83. <Button  Content="清空"  Command="{Binding ClearCommand}"   />throw new ArgumentNullException("execute");
  84. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  85. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  86. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  87. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  88. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  89. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  90. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  91. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  92. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  93. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  94. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  95. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  96. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_execute = execute;
  97. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_canExecute = canExecute;
  110. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  111. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  112. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  113. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  114. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  115. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  116. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  117. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  118. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  119. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  120. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  121. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  122. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  123. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public event EventHandler? CanExecuteChanged
  124. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  125. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  126. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  127. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  128. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  129. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  130. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  131. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  132. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  133. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  134. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  135. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  136. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  137. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  138. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  139. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  140. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  141. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  142. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  143. <Button  Content="清空"  Command="{Binding ClearCommand}"   />add { CommandManager.RequerySuggested += value; }
  144. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  145. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  146. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  147. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  148. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  149. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  150. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  151. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  152. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  153. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  154. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  155. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  156. <Button  Content="清空"  Command="{Binding ClearCommand}"   />remove { CommandManager.RequerySuggested -= value; }
  157. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  158. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  159. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  160. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  161. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  162. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  163. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  164. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  165. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  166. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  167. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  168. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  169. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  170. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public bool CanExecute(object parameter)
  171. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  172. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  173. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  174. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  175. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  176. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  177. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  178. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  179. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  180. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  181. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  182. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  183. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  184. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  185. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  186. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  187. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  188. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  189. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  190. <Button  Content="清空"  Command="{Binding ClearCommand}"   />return _canExecute == null ? true : _canExecute((T)parameter);
  191. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  192. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  193. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  194. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  195. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  196. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  197. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  198. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  199. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  200. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  201. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  202. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  203. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  204. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public void Execute(object parameter)
  205. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  206. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  207. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  208. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  209. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  210. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  211. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{
  212. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  213. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  214. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  215. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  216. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  217. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  218. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  219. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  220. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  221. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  222. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  223. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  224. <Button  Content="清空"  Command="{Binding ClearCommand}"   />_execute((T)parameter);
  225. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  226. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  227. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  228. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  229. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  230. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  231. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
  232. }
复制代码
4、通过binding绑定输入框的值和事件的操作,代替传统直接在后台cs文件写事件。
  1. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   />
复制代码
5、将MainWindow的DataContext赋值给ViewModel,我这里用了依赖注入的方法,所以直接是在app.cs里面赋值的,也可以在MainWindow.cs。
  1. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public partial class App : Application<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public App()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  26. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  27. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  28. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  29. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  30. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  31. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   />Services = ConfigureServices();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  44. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  45. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  46. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  47. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  48. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  49. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  50. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  51. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  52. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   />this.InitializeComponent();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  65. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  66. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  67. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  68. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  69. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  70. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  71. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  72. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  73. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  74. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  75. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  76. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  77. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  78. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  79. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  80. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  81. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  82. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// Gets the current<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  83. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  84. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  85. <Button  Content="清空"  Command="{Binding ClearCommand}"   />instance in use<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  86. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  87. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  88. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  89. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  90. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  91. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  92. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  93. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  94. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  95. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  96. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  97. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public new static App Current => (App)Application.Current;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  110. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  111. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  112. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  113. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  114. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  115. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  116. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  117. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  118. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  119. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  120. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  121. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// Gets the<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  122. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  123. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  124. <Button  Content="清空"  Command="{Binding ClearCommand}"   />instance to resolve application services.<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  125. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  126. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  127. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  128. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  129. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  130. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  131. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  132. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  133. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  134. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  135. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  136. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  137. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  138. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  139. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  140. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  141. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  142. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public IServiceProvider Services { get; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  143. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  144. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  145. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  146. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  147. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  148. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  149. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  150. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  151. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  152. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  153. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  154. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  155. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  156. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  157. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  158. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  159. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  160. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// Configures the services for the application.<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  161. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  162. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  163. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  164. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  165. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  166. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  167. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  168. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  169. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  170. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  171. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  172. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  173. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  174. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  175. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  176. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  177. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  178. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private static IServiceProvider ConfigureServices()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  179. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  180. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  181. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  182. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  183. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  184. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  185. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  186. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  187. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  188. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  189. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  190. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  191. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  192. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  193. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  194. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  195. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  196. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  197. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  198. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  199. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  200. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  201. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  202. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  203. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  204. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  205. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  206. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  207. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  208. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  209. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  210. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  211. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  212. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  213. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  214. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  215. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  216. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  217. <Button  Content="清空"  Command="{Binding ClearCommand}"   />var services = new ServiceCollection();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  218. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  219. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  220. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  221. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  222. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  223. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  224. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  225. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  226. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  227. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  228. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  229. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  230. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  231. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  232. <Button  Content="清空"  Command="{Binding ClearCommand}"   />services.AddTransient();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  233. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  234. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  235. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  236. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  237. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  238. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  239. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  240. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  241. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  242. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  243. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  244. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  245. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  246. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  247. <Button  Content="清空"  Command="{Binding ClearCommand}"   />services.AddTransient();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  248. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  249. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  250. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  251. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  252. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  253. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  254. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  255. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  256. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  257. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  258. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  259. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  260. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  261. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  262. <Button  Content="清空"  Command="{Binding ClearCommand}"   />services.AddTransient();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  263. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  264. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  265. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  266. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  267. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  268. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  269. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  270. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  271. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  272. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  273. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  274. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  275. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  276. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  277. <Button  Content="清空"  Command="{Binding ClearCommand}"   />services.AddTransient(sp=>new MainWindow() { DataContext=sp.GetRequiredService()});<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  278. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  279. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  280. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  281. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  282. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  283. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  284. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  285. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  286. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  287. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  288. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  289. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  290. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  291. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  292. <Button  Content="清空"  Command="{Binding ClearCommand}"   />return services.BuildServiceProvider();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  293. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  294. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  295. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  296. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  297. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  298. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  299. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  300. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  301. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  302. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  303. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  304. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  305. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  306. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  307. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  308. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  309. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  310. <Button  Content="清空"  Command="{Binding ClearCommand}"   />protected override void OnStartup(StartupEventArgs e)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  311. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  312. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  313. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  314. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  315. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  316. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  317. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  318. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  319. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  320. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  321. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  322. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  323. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  324. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  325. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  326. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  327. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  328. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  329. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  330. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  331. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  332. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  333. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  334. <Button  Content="清空"  Command="{Binding ClearCommand}"   />base.OnStartup(e);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  335. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  336. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  337. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  338. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  339. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  340. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  341. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  342. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  343. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  344. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  345. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  346. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  347. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  348. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  349. <Button  Content="清空"  Command="{Binding ClearCommand}"   />MainWindow= Services.GetRequiredService();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  350. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  351. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  352. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  353. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  354. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  355. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  356. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  357. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  358. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  359. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  360. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  361. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  362. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  363. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  364. <Button  Content="清空"  Command="{Binding ClearCommand}"   />MainWindow.Show();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  365. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  366. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  367. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  368. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  369. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  370. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  371. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  372. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  373. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  374. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  375. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  376. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
复制代码
  1. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public partial class MainWindow : Window<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public MainWindow()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  26. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  27. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  28. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  29. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  30. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  31. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  44. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  45. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  46. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  47. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  48. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  49. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  50. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  51. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  52. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   />InitializeComponent();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  65. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  66. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  67. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  68. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  69. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  70. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  71. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  72. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  73. <Button  Content="清空"  Command="{Binding ClearCommand}"   />DataContext =App.Current.Services.GetService();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  74. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  75. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  76. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  77. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  78. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  79. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  80. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  81. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  82. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  83. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  84. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  85. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  86. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  87. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  88. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  89. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  90. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  91. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}
复制代码
6、如果不用依赖注入的方式,可以在MainWindow.xaml或者MainWindow.cs将MainWindow的DataContext赋值给ViewModel。
  1. <TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   />
复制代码
  1. public partial class MainWindow : Window {<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> public MainWindow()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> {<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> InitializeComponent();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  26. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  27. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  28. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  29. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  30. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  31. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> DataContext =new KeyPressViewModel();<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> } }
复制代码
以上就是自己去实现mvvm的方式,会比较繁琐,如果不是复杂的项目大多数还是用社区的CommunityToolkit.MVVM,复杂的项目可以使用Prism
二、使用微软社区的CommunityToolkit.MVVM

1、首先安装CommunityToolkit.MVVM的包。
1.png

2、创建一个新的类KeyPressViewModelCommunityToolkit类,继承ObservableObject,CommunityToolkit代码就简洁很多了,直接在方法或者属性上面加特性就可以。
  1. public partial class KeyPressViewModelCommunityToolkit : ObservableObject{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   />[ObservableProperty]<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private string cardNumber = string.Empty;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   />[ObservableProperty]<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private int selectionStart;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  26. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  27. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  28. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  29. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  30. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  31. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 数字点击事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  44. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  45. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  46. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  47. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  48. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  49. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> ///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  50. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  51. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  52. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> [RelayCommand]<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private void Number(string? key)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  65. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  66. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  67. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  68. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  69. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  70. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  71. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  72. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  73. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  74. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  75. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  76. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  77. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  78. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  79. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber += key;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  80. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  81. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  82. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  83. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  84. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  85. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  86. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  87. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  88. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  89. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  90. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  91. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  92. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  93. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  94. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  95. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  96. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  97. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 清空输入框<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> [RelayCommand]<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  110. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  111. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  112. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  113. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  114. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  115. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private void Clear()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  116. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  117. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  118. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  119. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  120. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  121. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  122. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  123. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  124. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  125. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  126. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  127. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  128. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  129. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  130. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  131. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  132. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  133. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = string.Empty;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  134. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  135. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  136. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  137. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  138. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  139. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  140. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  141. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  142. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  143. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  144. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  145. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  146. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  147. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  148. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  149. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  150. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  151. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 删除点击事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  152. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  153. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  154. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  155. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  156. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  157. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  158. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  159. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  160. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  161. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  162. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  163. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> [RelayCommand]<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  164. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  165. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  166. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  167. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  168. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  169. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private void Delete()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  170. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  171. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  172. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  173. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  174. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  175. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  176. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  177. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  178. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  179. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  180. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  181. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  182. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  183. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  184. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  185. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  186. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  187. <Button  Content="清空"  Command="{Binding ClearCommand}"   />// 光标在输入框时,删除光标前一个字符<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  188. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  189. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  190. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  191. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  192. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  193. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  194. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  195. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  196. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  197. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  198. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  199. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (!string.IsNullOrEmpty(CardNumber) && SelectionStart > 0)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  200. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  201. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  202. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  203. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  204. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  205. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  206. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  207. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  208. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  209. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  210. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  211. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  212. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  213. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  214. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  215. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  216. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  217. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  218. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  219. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  220. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  221. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  222. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  223. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  224. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  225. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  226. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  227. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  228. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  229. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = CardNumber.Remove(SelectionStart - 1, 1);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  230. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  231. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  232. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  233. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  234. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  235. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  236. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  237. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  238. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  239. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  240. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  241. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  242. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  243. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  244. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  245. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  246. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  247. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  248. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  249. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  250. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  251. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  252. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  253. <Button  Content="清空"  Command="{Binding ClearCommand}"   />//光标没有在输入框时,删除最后一个字符<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  254. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  255. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  256. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  257. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  258. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  259. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  260. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  261. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  262. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  263. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  264. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  265. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (SelectionStart == 0)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  266. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  267. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  268. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  269. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  270. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  271. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  272. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  273. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  274. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  275. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  276. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  277. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  278. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  279. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  280. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  281. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  282. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  283. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  284. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  285. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  286. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  287. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  288. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  289. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  290. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  291. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  292. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  293. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  294. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  295. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = CardNumber.Remove(CardNumber.Length - 1, 1);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  296. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  297. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  298. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  299. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  300. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  301. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  302. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  303. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  304. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  305. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  306. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  307. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  308. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  309. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  310. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  311. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  312. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  313. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}}
复制代码
三、Prism

1、安装Prism.Core和Prism.Wpf,其他的包根据后续实际使用在安装。
2.png

2、创建一个KeyPressViewModelPrism类继承BindableBase。
  1. public partial class KeyPressViewModelPrism : BindableBase{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  2. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  3. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  4. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  5. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  6. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  7. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private string cardNumber;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  8. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  9. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  10. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  11. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  12. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  13. <Button  Content="清空"  Command="{Binding ClearCommand}"   />private int selectionStart;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  14. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  15. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  16. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  17. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  18. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  19. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public string CardNumber<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  20. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  21. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  22. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  23. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  24. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  25. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  26. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  27. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  28. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  29. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  30. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  31. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  32. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  33. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  34. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  35. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  36. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  37. <Button  Content="清空"  Command="{Binding ClearCommand}"   />get { return cardNumber; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  38. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  39. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  40. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  41. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  42. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  43. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  44. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  45. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  46. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  47. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  48. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  49. <Button  Content="清空"  Command="{Binding ClearCommand}"   />set { SetProperty(ref cardNumber, value); }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  50. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  51. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  52. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  53. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  54. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  55. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  56. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  57. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  58. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  59. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  60. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  61. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public int SelectionStart<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  62. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  63. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  64. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  65. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  66. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  67. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  68. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  69. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  70. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  71. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  72. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  73. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  74. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  75. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  76. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  77. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  78. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  79. <Button  Content="清空"  Command="{Binding ClearCommand}"   />get { return selectionStart; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  80. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  81. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  82. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  83. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  84. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  85. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  86. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  87. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  88. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  89. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  90. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  91. <Button  Content="清空"  Command="{Binding ClearCommand}"   />set { SetProperty(ref selectionStart, value); }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  92. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  93. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  94. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  95. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  96. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  97. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  98. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  99. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  100. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  101. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  102. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  103. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public DelegateCommand NumberCommand { get; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  104. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  105. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  106. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  107. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  108. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  109. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public DelegateCommand ClearCommand { get; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  110. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  111. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  112. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  113. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  114. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  115. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public DelegateCommand DeleteCommand { get; }<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  116. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  117. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  118. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  119. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  120. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  121. <Button  Content="清空"  Command="{Binding ClearCommand}"   />public KeyPressViewModelPrism()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  122. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  123. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  124. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  125. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  126. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  127. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  128. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  129. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  130. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  131. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  132. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  133. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  134. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  135. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  136. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  137. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  138. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  139. <Button  Content="清空"  Command="{Binding ClearCommand}"   />NumberCommand = new DelegateCommand(Number);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  140. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  141. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  142. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  143. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  144. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  145. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  146. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  147. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  148. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  149. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  150. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  151. <Button  Content="清空"  Command="{Binding ClearCommand}"   />ClearCommand = new DelegateCommand(Clear);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  152. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  153. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  154. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  155. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  156. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  157. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  158. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  159. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  160. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  161. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  162. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  163. <Button  Content="清空"  Command="{Binding ClearCommand}"   />DeleteCommand = new DelegateCommand(Delete);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  164. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  165. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  166. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  167. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  168. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  169. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  170. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  171. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  172. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  173. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  174. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  175. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  176. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  177. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  178. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  179. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  180. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  181. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 数字点击事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  182. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  183. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  184. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  185. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  186. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  187. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  188. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  189. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  190. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  191. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  192. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  193. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> ///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  194. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  195. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  196. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  197. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  198. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  199. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Number(string? key)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  200. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  201. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  202. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  203. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  204. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  205. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  206. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  207. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  208. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  209. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  210. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  211. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  212. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  213. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  214. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  215. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  216. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  217. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber += key;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  218. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  219. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  220. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  221. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  222. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  223. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  224. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  225. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  226. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  227. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  228. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  229. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  230. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  231. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  232. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  233. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  234. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  235. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 清空点击事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  236. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  237. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  238. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  239. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  240. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  241. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  242. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  243. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  244. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  245. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  246. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  247. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Clear()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  248. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  249. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  250. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  251. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  252. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  253. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  254. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  255. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  256. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  257. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  258. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  259. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  260. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  261. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  262. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  263. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  264. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  265. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = string.Empty;<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  266. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  267. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  268. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  269. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  270. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  271. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  272. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  273. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  274. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  275. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  276. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  277. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  278. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  279. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  280. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  281. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  282. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  283. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> /// 删除点击事件<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  284. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  285. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  286. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  287. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  288. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  289. <Button  Content="清空"  Command="{Binding ClearCommand}"   />///<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  290. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  291. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  292. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  293. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  294. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  295. <Button  Content="清空"  Command="{Binding ClearCommand}"   /> private void Delete()<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  296. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  297. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  298. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  299. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  300. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  301. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  302. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  303. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  304. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  305. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  306. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  307. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  308. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  309. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  310. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  311. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  312. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  313. <Button  Content="清空"  Command="{Binding ClearCommand}"   />// 光标在输入框时,删除光标前一个字符<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  314. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  315. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  316. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  317. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  318. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  319. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  320. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  321. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  322. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  323. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  324. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  325. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (!string.IsNullOrEmpty(CardNumber) && SelectionStart > 0)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  326. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  327. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  328. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  329. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  330. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  331. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  332. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  333. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  334. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  335. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  336. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  337. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  338. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  339. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  340. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  341. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  342. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  343. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  344. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  345. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  346. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  347. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  348. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  349. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  350. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  351. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  352. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  353. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  354. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  355. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = CardNumber.Remove(SelectionStart - 1, 1);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  356. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  357. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  358. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  359. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  360. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  361. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  362. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  363. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  364. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  365. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  366. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  367. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  368. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  369. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  370. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  371. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  372. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  373. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  374. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  375. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  376. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  377. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  378. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  379. <Button  Content="清空"  Command="{Binding ClearCommand}"   />//光标没有在输入框时,删除最后一个字符<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  380. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  381. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  382. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  383. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  384. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  385. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  386. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  387. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  388. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  389. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  390. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  391. <Button  Content="清空"  Command="{Binding ClearCommand}"   />if (SelectionStart == 0)<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  392. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  393. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  394. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  395. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  396. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  397. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  398. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  399. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  400. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  401. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  402. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  403. <Button  Content="清空"  Command="{Binding ClearCommand}"   />{<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  404. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  405. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  406. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  407. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  408. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  409. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  410. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  411. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  412. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  413. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  414. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  415. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  416. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  417. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  418. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  419. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  420. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  421. <Button  Content="清空"  Command="{Binding ClearCommand}"   />CardNumber = CardNumber.Remove(CardNumber.Length - 1, 1);<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  422. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  423. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  424. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  425. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  426. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  427. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  428. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  429. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  430. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  431. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  432. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  433. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}<TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  434. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  435. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  436. <Button  Content="清空"  Command="{Binding ClearCommand}"   /><TextBox Text="{Binding CardNumber}"     x:Name="CardNumberTextBox"   local:TextBoxSelectionHelper.SelectionStart="{Binding SelectionStart, Mode=TwoWay}" Height="40"     Width="460" />  
  437. <Button  Content="1"  Command="{Binding NumberCommand}"  CommandParameter="1"/>
  438. <Button  Content="删除"  Command="{Binding DeleteCommand}"   />
  439. <Button  Content="清空"  Command="{Binding ClearCommand}"   />}}
复制代码
四、总结

以上就是三种不同ViewModel的实现方式,个人比较推荐使用社区的CommunityToolkit,但是还是要根据自己的项目情况来决定。

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

相关推荐

您需要登录后才可以回帖 登录 | 立即注册