|
| 1 | +using Avalonia; |
| 2 | +using Avalonia.Media; |
| 3 | + |
| 4 | +namespace HandyControl.Controls; |
| 5 | + |
| 6 | +public class VisualElement |
| 7 | +{ |
| 8 | + public static readonly AttachedProperty<IBrush> HighlightBrushProperty = |
| 9 | + AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBrush", inherits: true); |
| 10 | + |
| 11 | + public static void SetHighlightBrush(AvaloniaObject element, IBrush value) => |
| 12 | + element.SetValue(HighlightBrushProperty, value); |
| 13 | + |
| 14 | + public static IBrush GetHighlightBrush(AvaloniaObject element) => element.GetValue(HighlightBrushProperty); |
| 15 | + |
| 16 | + public static readonly AttachedProperty<IBrush> HighlightBackgroundProperty = |
| 17 | + AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBackground", inherits: true); |
| 18 | + |
| 19 | + public static void SetHighlightBackground(AvaloniaObject element, IBrush value) => |
| 20 | + element.SetValue(HighlightBackgroundProperty, value); |
| 21 | + |
| 22 | + public static IBrush GetHighlightBackground(AvaloniaObject element) => |
| 23 | + element.GetValue(HighlightBackgroundProperty); |
| 24 | + |
| 25 | + public static readonly AttachedProperty<IBrush> HighlightBorderBrushProperty = |
| 26 | + AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBorderBrush", |
| 27 | + inherits: true); |
| 28 | + |
| 29 | + public static void SetHighlightBorderBrush(AvaloniaObject element, IBrush value) => |
| 30 | + element.SetValue(HighlightBorderBrushProperty, value); |
| 31 | + |
| 32 | + public static IBrush GetHighlightBorderBrush(AvaloniaObject element) => |
| 33 | + element.GetValue(HighlightBorderBrushProperty); |
| 34 | + |
| 35 | + public static readonly AttachedProperty<IBrush> HighlightForegroundProperty = |
| 36 | + AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightForeground", inherits: true); |
| 37 | + |
| 38 | + public static void SetHighlightForeground(AvaloniaObject element, IBrush value) => |
| 39 | + element.SetValue(HighlightForegroundProperty, value); |
| 40 | + |
| 41 | + public static IBrush GetHighlightForeground(AvaloniaObject element) => |
| 42 | + element.GetValue(HighlightForegroundProperty); |
| 43 | + |
| 44 | + public static readonly AttachedProperty<string> TextProperty = |
| 45 | + AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, string>("Text"); |
| 46 | + |
| 47 | + public static void SetText(AvaloniaObject element, string value) => element.SetValue(TextProperty, value); |
| 48 | + |
| 49 | + public static string GetText(AvaloniaObject element) => element.GetValue(TextProperty); |
| 50 | +} |
0 commit comments