PathButton.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.Media;
  9. namespace CyberX8_Themes.CustomControls
  10. {
  11. public class PathButton:Button
  12. {
  13. static PathButton()
  14. {
  15. DefaultStyleKeyProperty.OverrideMetadata(typeof(PathButton), new FrameworkPropertyMetadata(typeof(PathButton)));
  16. }
  17. public Geometry PathData
  18. {
  19. get { return (Geometry)GetValue(PathDataProperty); }
  20. set { SetValue(PathDataProperty, value); }
  21. }
  22. // Using a DependencyProperty as the backing store for PathData. This enables animation, styling, binding, etc...
  23. public static readonly DependencyProperty PathDataProperty =
  24. DependencyProperty.Register("PathData", typeof(Geometry), typeof(PathButton), new PropertyMetadata(new PathGeometry()));
  25. public Brush DefaultFillBrush
  26. {
  27. get { return (Brush)GetValue(DefaultFillBrushProperty); }
  28. set { SetValue(DefaultFillBrushProperty, value); }
  29. }
  30. // Using a DependencyProperty as the backing store for DefaultFillBrush. This enables animation, styling, binding, etc...
  31. public static readonly DependencyProperty DefaultFillBrushProperty =
  32. DependencyProperty.Register("DefaultFillBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DarkGray));
  33. public Brush MouseOverBrush
  34. {
  35. get { return (Brush)GetValue(MouseOverBrushProperty); }
  36. set { SetValue(MouseOverBrushProperty, value); }
  37. }
  38. // Using a DependencyProperty as the backing store for MouseOverBrush. This enables animation, styling, binding, etc...
  39. public static readonly DependencyProperty MouseOverBrushProperty =
  40. DependencyProperty.Register("MouseOverBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DeepSkyBlue));
  41. public Brush IsPressedBrush
  42. {
  43. get { return (Brush)GetValue(IsPressedBrushProperty); }
  44. set { SetValue(IsPressedBrushProperty, value); }
  45. }
  46. // Using a DependencyProperty as the backing store for IsPressedBrush. This enables animation, styling, binding, etc...
  47. public static readonly DependencyProperty IsPressedBrushProperty =
  48. DependencyProperty.Register("IsPressedBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.DodgerBlue));
  49. public Brush IsEnabledBrush
  50. {
  51. get { return (Brush)GetValue(IsEnabledBrushProperty); }
  52. set { SetValue(IsEnabledBrushProperty, value); }
  53. }
  54. // Using a DependencyProperty as the backing store for IsEnabledBrush. This enables animation, styling, binding, etc...
  55. public static readonly DependencyProperty IsEnabledBrushProperty =
  56. DependencyProperty.Register("IsEnabledBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(Brushes.LightGray));
  57. public override void OnApplyTemplate()
  58. {
  59. base.OnApplyTemplate();
  60. }
  61. }
  62. }