forked from MaterialDesignInXAML/MaterialDesignInXamlToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListBoxItemAssist.cs
More file actions
75 lines (56 loc) · 3.47 KB
/
ListBoxItemAssist.cs
File metadata and controls
75 lines (56 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf;
public static class ListBoxItemAssist
{
private static readonly CornerRadius DefaultCornerRadius = new(2.0);
#region AttachedProperty : CornerRadiusProperty
/// <summary>
/// Controls the corner radius of the selection box.
/// </summary>
public static readonly DependencyProperty CornerRadiusProperty
= DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ListBoxItemAssist), new PropertyMetadata(DefaultCornerRadius));
public static CornerRadius GetCornerRadius(DependencyObject element)
=> (CornerRadius)element.GetValue(CornerRadiusProperty);
public static void SetCornerRadius(DependencyObject element, CornerRadius value) => element.SetValue(CornerRadiusProperty, value);
#endregion
#region HoverBackground
public static Brush? GetHoverBackground(DependencyObject obj)
=> (Brush?)obj.GetValue(HoverBackgroundProperty);
public static void SetHoverBackground(DependencyObject obj, Brush? value)
=> obj.SetValue(HoverBackgroundProperty, value);
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.RegisterAttached("HoverBackground", typeof(Brush), typeof(ListBoxItemAssist), new PropertyMetadata(null));
#endregion HoverBackground
#region SelectedFocusedBackground
public static Brush? GetSelectedFocusedBackground(DependencyObject obj)
=> (Brush?)obj.GetValue(SelectedFocusedBackgroundProperty);
public static void SetSelectedFocusedBackground(DependencyObject obj, Brush? value)
=> obj.SetValue(SelectedFocusedBackgroundProperty, value);
public static readonly DependencyProperty SelectedFocusedBackgroundProperty =
DependencyProperty.RegisterAttached("SelectedFocusedBackground", typeof(Brush), typeof(ListBoxItemAssist), new PropertyMetadata(null));
#endregion SelectedFocusedBackground
#region SelectedUnfocusedBackground
public static Brush? GetSelectedUnfocusedBackground(DependencyObject obj)
=> (Brush?)obj.GetValue(SelectedUnfocusedBackgroundProperty);
public static void SetSelectedUnfocusedBackground(DependencyObject obj, Brush? value)
=> obj.SetValue(SelectedUnfocusedBackgroundProperty, value);
public static readonly DependencyProperty SelectedUnfocusedBackgroundProperty =
DependencyProperty.RegisterAttached("SelectedUnfocusedBackground", typeof(Brush), typeof(ListBoxItemAssist), new PropertyMetadata(null));
#endregion SelectedFocusedBackground
#region ShowSelection
public static bool GetShowSelection(DependencyObject element)
=> (bool)element.GetValue(ShowSelectionProperty);
public static void SetShowSelection(DependencyObject element, bool value)
=> element.SetValue(ShowSelectionProperty, value);
public static readonly DependencyProperty ShowSelectionProperty =
DependencyProperty.RegisterAttached("ShowSelection", typeof(bool), typeof(ListBoxItemAssist), new PropertyMetadata(true));
#endregion
#region Cursor
public static Cursor GetCursor(DependencyObject obj)
=> (Cursor)obj.GetValue(CursorProperty);
public static void SetCursor(DependencyObject obj, Cursor value)
=> obj.SetValue(CursorProperty, value);
public static readonly DependencyProperty CursorProperty =
DependencyProperty.RegisterAttached("Cursor", typeof(Cursor), typeof(ListBoxItemAssist), new PropertyMetadata(Cursors.Hand));
#endregion
}