PendulumValve.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Media;
  5. namespace Venus_Themes.UserControls
  6. {
  7. /// <summary>
  8. /// PendulumValve.xaml 的交互逻辑
  9. /// </summary>
  10. public partial class PendulumValve : UserControl
  11. {
  12. public PendulumValve()
  13. {
  14. InitializeComponent();
  15. }
  16. public static readonly DependencyProperty OpeningProperty = DependencyProperty.Register(
  17. "Opening", typeof(int), typeof(PendulumValve));
  18. public int Opening
  19. {
  20. get { return (int)this.GetValue(OpeningProperty); }
  21. set
  22. {
  23. this.SetValue(OpeningProperty, value);
  24. }
  25. }
  26. public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register(
  27. "IsOpen", typeof(bool), typeof(PendulumValve),new PropertyMetadata(false,new PropertyChangedCallback(OnPropertyChanged)));
  28. static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  29. {
  30. if (Convert.ToBoolean(e.NewValue) == true)
  31. {
  32. }
  33. }
  34. public bool IsOpen
  35. {
  36. get
  37. {
  38. return (bool)this.GetValue(IsOpenProperty);
  39. }
  40. set
  41. {
  42. this.SetValue(IsOpenProperty, value);
  43. }
  44. }
  45. public static readonly DependencyProperty IsOpenColorProperty = DependencyProperty.Register(
  46. "IsOpenColor", typeof(SolidColorBrush), typeof(PendulumValve));
  47. public SolidColorBrush IsOpenColor
  48. {
  49. get
  50. {
  51. return (SolidColorBrush)this.GetValue(IsOpenColorProperty);
  52. }
  53. set
  54. {
  55. this.SetValue(IsOpenColorProperty, value);
  56. }
  57. }
  58. }
  59. }