CheckBoxExt.cs 965 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. namespace OpenSEMI.Ctrlib.Controls
  9. {
  10. public class CheckBoxExt:CheckBox
  11. {
  12. public bool CheckBoxSaved
  13. {
  14. get { return (bool)GetValue(CheckBoxSavedProperty); }
  15. set { SetValue(CheckBoxSavedProperty, value); }
  16. }
  17. public static readonly DependencyProperty CheckBoxSavedProperty =
  18. DependencyProperty.Register("CheckBoxSaved", typeof(bool), typeof(CheckBoxExt),
  19. new UIPropertyMetadata(true));
  20. protected override void OnUnchecked(RoutedEventArgs e)
  21. {
  22. base.OnUnchecked(e);
  23. this.CheckBoxSaved = false;
  24. }
  25. protected override void OnChecked(RoutedEventArgs e)
  26. {
  27. base.OnChecked(e);
  28. this.CheckBoxSaved = false;
  29. }
  30. }
  31. }