ElementForeground.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Windows;
  2. using System.Windows.Media;
  3. namespace CyberX8_UI.Themes.Attach
  4. {
  5. public class ElementForeground
  6. {
  7. /// <summary>
  8. /// 默认颜色
  9. /// </summary>
  10. public static readonly DependencyProperty NormalForegroundProperty = DependencyProperty.RegisterAttached(
  11. "NormalForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  12. public static void SetNormalForeground(DependencyObject element, SolidColorBrush value)
  13. => element.SetValue(NormalForegroundProperty, value);
  14. public static SolidColorBrush GetNormalForeground(DependencyObject element)
  15. => (SolidColorBrush)element.GetValue(NormalForegroundProperty);
  16. /// <summary>
  17. /// 选中颜色
  18. /// </summary>
  19. public static readonly DependencyProperty SelectedForegroundProperty = DependencyProperty.RegisterAttached(
  20. "SelectedForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  21. public static void SetSelectedForeground(DependencyObject element, SolidColorBrush value)
  22. => element.SetValue(SelectedForegroundProperty, value);
  23. public static SolidColorBrush GetSelectedForeground(DependencyObject element)
  24. => (SolidColorBrush)element.GetValue(SelectedForegroundProperty);
  25. /// <summary>
  26. /// 高亮颜色
  27. /// </summary>
  28. public static readonly DependencyProperty HighlightForegroundProperty = DependencyProperty.RegisterAttached(
  29. "HighlightForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  30. public static void SetHighlightForeground(DependencyObject element, SolidColorBrush value)
  31. => element.SetValue(HighlightForegroundProperty, value);
  32. public static SolidColorBrush GetHighlightForeground(DependencyObject element)
  33. => (SolidColorBrush)element.GetValue(HighlightForegroundProperty);
  34. /// <summary>
  35. /// 鼠标悬浮颜色
  36. /// </summary>
  37. public static readonly DependencyProperty MouseOverForegroundProperty = DependencyProperty.RegisterAttached(
  38. "MouseOverForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  39. public static void SetMouseOverForeground(DependencyObject element, SolidColorBrush value)
  40. => element.SetValue(MouseOverForegroundProperty, value);
  41. public static SolidColorBrush GetMouseOverForeground(DependencyObject element)
  42. => (SolidColorBrush)element.GetValue(MouseOverForegroundProperty);
  43. /// <summary>
  44. /// 鼠标悬浮颜色
  45. /// </summary>
  46. public static readonly DependencyProperty PressedForegroundProperty = DependencyProperty.RegisterAttached(
  47. "PressedForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  48. public static void SetPressedForeground(DependencyObject element, SolidColorBrush value)
  49. => element.SetValue(PressedForegroundProperty, value);
  50. public static SolidColorBrush GetPressedForeground(DependencyObject element)
  51. => (SolidColorBrush)element.GetValue(PressedForegroundProperty);
  52. /// <summary>
  53. /// 禁用颜色
  54. /// </summary>
  55. public static readonly DependencyProperty DisabledForegroundProperty = DependencyProperty.RegisterAttached(
  56. "DisabledForeground", typeof(SolidColorBrush), typeof(ElementForeground), new PropertyMetadata(default(SolidColorBrush)));
  57. public static void SetDisabledForeground(DependencyObject element, SolidColorBrush value)
  58. => element.SetValue(DisabledForegroundProperty, value);
  59. public static SolidColorBrush GetDisabledForeground(DependencyObject element)
  60. => (SolidColorBrush)element.GetValue(DisabledForegroundProperty);
  61. }
  62. }