PathButton.xaml.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace CyberX8_Themes.UserControls
  16. {
  17. /// <summary>
  18. /// PathButton.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class PathButton : Button
  21. {
  22. public PathButton()
  23. {
  24. InitializeComponent();
  25. DataContext = this;
  26. }
  27. public Geometry PathData
  28. {
  29. get { return (Geometry)GetValue(PathDataProperty); }
  30. set { SetValue(PathDataProperty, value); }
  31. }
  32. // Using a DependencyProperty as the backing store for PathData. This enables animation, styling, binding, etc...
  33. public static readonly DependencyProperty PathDataProperty =
  34. DependencyProperty.Register("PathData", typeof(Geometry), typeof(PathButton), new PropertyMetadata(new PathGeometry()));
  35. public Brush DefaultFillBrush
  36. {
  37. get { return (Brush)GetValue(DefaultFillBrushProperty); }
  38. set { SetValue(DefaultFillBrushProperty, value); }
  39. }
  40. // Using a DependencyProperty as the backing store for DefaultFillBrush. This enables animation, styling, binding, etc...
  41. public static readonly DependencyProperty DefaultFillBrushProperty =
  42. DependencyProperty.Register("DefaultFillBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DarkGray));
  43. public Brush MouseOverBrush
  44. {
  45. get { return (Brush)GetValue(MouseOverBrushProperty); }
  46. set { SetValue(MouseOverBrushProperty, value); }
  47. }
  48. // Using a DependencyProperty as the backing store for MouseOverBrush. This enables animation, styling, binding, etc...
  49. public static readonly DependencyProperty MouseOverBrushProperty =
  50. DependencyProperty.Register("MouseOverBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DeepSkyBlue));
  51. public Brush IsPressedBrush
  52. {
  53. get { return (Brush)GetValue(IsPressedBrushProperty); }
  54. set { SetValue(IsPressedBrushProperty, value); }
  55. }
  56. // Using a DependencyProperty as the backing store for IsPressedBrush. This enables animation, styling, binding, etc...
  57. public static readonly DependencyProperty IsPressedBrushProperty =
  58. DependencyProperty.Register("IsPressedBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DodgerBlue));
  59. public Brush IsEnabledBrush
  60. {
  61. get { return (Brush)GetValue(IsEnabledBrushProperty); }
  62. set { SetValue(IsEnabledBrushProperty, value); }
  63. }
  64. // Using a DependencyProperty as the backing store for IsEnabledBrush. This enables animation, styling, binding, etc...
  65. public static readonly DependencyProperty IsEnabledBrushProperty =
  66. DependencyProperty.Register("IsEnabledBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.LightGray));
  67. }
  68. }