BackgroundSwitchElement.cs 1.2 KB

123456789101112131415161718192021
  1. using System.Windows;
  2. using System.Windows.Media;
  3. namespace HandyControl.Controls;
  4. public class BackgroundSwitchElement
  5. {
  6. public static readonly DependencyProperty MouseHoverBackgroundProperty = DependencyProperty.RegisterAttached(
  7. "MouseHoverBackground", typeof(Brush), typeof(BackgroundSwitchElement), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits));
  8. public static void SetMouseHoverBackground(DependencyObject element, Brush value) => element.SetValue(MouseHoverBackgroundProperty, value);
  9. public static Brush GetMouseHoverBackground(DependencyObject element) => (Brush) element.GetValue(MouseHoverBackgroundProperty);
  10. public static readonly DependencyProperty MouseDownBackgroundProperty = DependencyProperty.RegisterAttached(
  11. "MouseDownBackground", typeof(Brush), typeof(BackgroundSwitchElement), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits));
  12. public static void SetMouseDownBackground(DependencyObject element, Brush value) => element.SetValue(MouseDownBackgroundProperty, value);
  13. public static Brush GetMouseDownBackground(DependencyObject element) => (Brush) element.GetValue(MouseDownBackgroundProperty);
  14. }