CustomControlViewModel.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using MvvmScaffoldFrame48.DLL;
  2. using MvvmScaffoldFrame48.DLL.AuditTrail;
  3. using MvvmScaffoldFrame48.DLL.WindowsTools;
  4. using MvvmScaffoldFrame48.Model;
  5. using MvvmScaffoldFrame48.Model.StorageModel.AuditTrail;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Collections.ObjectModel;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Input;
  13. namespace MvvmScaffoldFrame48.ViewModel.ViewModel
  14. {
  15. public class CustomControlViewModel:BaseViewModel
  16. {
  17. #region 界面绑定属性
  18. private bool _staticTest = false;
  19. public bool StaticTest
  20. {
  21. get { return _staticTest; }
  22. set
  23. {
  24. if (_staticTest != value)
  25. {
  26. _staticTest = value;
  27. OnPropertyChanged(nameof(StaticTest));
  28. }
  29. }
  30. }
  31. #endregion
  32. #region 界面绑定事件
  33. public ICommand TestCommand { get; set; }
  34. #endregion
  35. #region 属性
  36. #endregion
  37. #region 绑定用Action方法
  38. private void Test(object obj)
  39. {
  40. StaticTest = !StaticTest;
  41. }
  42. #endregion
  43. #region 绑定用Predicate方法
  44. private bool CanTest(object obj)
  45. {
  46. return true;
  47. }
  48. #endregion
  49. #region 其他方法
  50. public CustomControlViewModel()
  51. {
  52. TestCommand = new RelayCommand(Test, CanTest);
  53. }
  54. #endregion
  55. }
  56. }