PathButton.xaml.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Media;
  4. namespace Venus_Themes.UserControls
  5. {
  6. /// <summary>
  7. /// PathButton.xaml 的交互逻辑
  8. /// </summary>
  9. public partial class PathButton :Button
  10. {
  11. public PathButton()
  12. {
  13. InitializeComponent();
  14. DataContext = this;
  15. }
  16. public Geometry PathData
  17. {
  18. get { return (Geometry)GetValue(PathDataProperty); }
  19. set { SetValue(PathDataProperty, value); }
  20. }
  21. // Using a DependencyProperty as the backing store for PathData. This enables animation, styling, binding, etc...
  22. public static readonly DependencyProperty PathDataProperty =
  23. DependencyProperty.Register("PathData", typeof(Geometry), typeof(PathButton), new PropertyMetadata(new PathGeometry()));
  24. public Brush DefaultFillBrush
  25. {
  26. get { return (Brush)GetValue(DefaultFillBrushProperty); }
  27. set { SetValue(DefaultFillBrushProperty, value); }
  28. }
  29. // Using a DependencyProperty as the backing store for DefaultFillBrush. This enables animation, styling, binding, etc...
  30. public static readonly DependencyProperty DefaultFillBrushProperty =
  31. DependencyProperty.Register("DefaultFillBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DarkGray));
  32. public Brush MouseOverBrush
  33. {
  34. get { return (Brush)GetValue(MouseOverBrushProperty); }
  35. set { SetValue(MouseOverBrushProperty, value); }
  36. }
  37. // Using a DependencyProperty as the backing store for MouseOverBrush. This enables animation, styling, binding, etc...
  38. public static readonly DependencyProperty MouseOverBrushProperty =
  39. DependencyProperty.Register("MouseOverBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DeepSkyBlue));
  40. public Brush IsPressedBrush
  41. {
  42. get { return (Brush)GetValue(IsPressedBrushProperty); }
  43. set { SetValue(IsPressedBrushProperty, value); }
  44. }
  45. // Using a DependencyProperty as the backing store for IsPressedBrush. This enables animation, styling, binding, etc...
  46. public static readonly DependencyProperty IsPressedBrushProperty =
  47. DependencyProperty.Register("IsPressedBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DodgerBlue));
  48. public Brush IsEnabledBrush
  49. {
  50. get { return (Brush)GetValue(IsEnabledBrushProperty); }
  51. set { SetValue(IsEnabledBrushProperty, value); }
  52. }
  53. // Using a DependencyProperty as the backing store for IsEnabledBrush. This enables animation, styling, binding, etc...
  54. public static readonly DependencyProperty IsEnabledBrushProperty =
  55. DependencyProperty.Register("IsEnabledBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.LightGray));
  56. }
  57. }