1
- using System . Windows ;
1
+ using System ;
2
+ using System . Windows ;
2
3
using System . Windows . Controls . Primitives ;
4
+ using System . Windows . Media ;
3
5
4
6
namespace MaterialDesignThemes . Wpf
5
7
{
6
8
public static class ToggleButtonAssist
7
9
{
10
+
8
11
private static readonly DependencyPropertyKey HasOnContentPropertyKey =
9
12
DependencyProperty . RegisterAttachedReadOnly (
10
13
"HasOnContent" , typeof ( bool ) , typeof ( ToggleButtonAssist ) ,
@@ -31,7 +34,7 @@ public static bool GetHasOnContent(DependencyObject element)
31
34
/// Allows on (IsChecked) content to be provided on supporting <see cref="ToggleButton"/> styles.
32
35
/// </summary>
33
36
public static readonly DependencyProperty OnContentProperty = DependencyProperty . RegisterAttached (
34
- "OnContent" , typeof ( object ) , typeof ( ToggleButtonAssist ) , new PropertyMetadata ( default ( object ) , OnContentPropertyChangedCallback ) ) ;
37
+ "OnContent" , typeof ( object ) , typeof ( ToggleButtonAssist ) , new PropertyMetadata ( default ( object ) , OnContentPropertyChangedCallback ) ) ;
35
38
36
39
private static void OnContentPropertyChangedCallback ( DependencyObject dependencyObject , DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs )
37
40
{
@@ -53,14 +56,14 @@ public static void SetOnContent(DependencyObject element, object value)
53
56
/// </summary>
54
57
public static object GetOnContent ( DependencyObject element )
55
58
{
56
- return ( object ) element . GetValue ( OnContentProperty ) ;
59
+ return ( object ) element . GetValue ( OnContentProperty ) ;
57
60
}
58
61
59
62
/// <summary>
60
63
/// Allows an on (IsChecked) template to be provided on supporting <see cref="ToggleButton"/> styles.
61
64
/// </summary>
62
65
public static readonly DependencyProperty OnContentTemplateProperty = DependencyProperty . RegisterAttached (
63
- "OnContentTemplate" , typeof ( DataTemplate ) , typeof ( ToggleButtonAssist ) , new PropertyMetadata ( default ( DataTemplate ) ) ) ;
66
+ "OnContentTemplate" , typeof ( DataTemplate ) , typeof ( ToggleButtonAssist ) , new PropertyMetadata ( default ( DataTemplate ) ) ) ;
64
67
65
68
/// <summary>
66
69
/// Allows an on (IsChecked) template to be provided on supporting <see cref="ToggleButton"/> styles.
@@ -75,7 +78,35 @@ public static void SetOnContentTemplate(DependencyObject element, DataTemplate v
75
78
/// </summary>
76
79
public static DataTemplate GetOnContentTemplate ( DependencyObject element )
77
80
{
78
- return ( DataTemplate ) element . GetValue ( OnContentTemplateProperty ) ;
81
+ return ( DataTemplate ) element . GetValue ( OnContentTemplateProperty ) ;
82
+ }
83
+
84
+ public static DependencyProperty SwitchTrackOnBackgroundProperty =
85
+ DependencyProperty . RegisterAttached (
86
+ "SwitchTrackOnBackground" , typeof ( SolidColorBrush ) , typeof ( ToggleButtonAssist ) ) ;
87
+
88
+ public static void SetSwitchTrackOnBackground ( DependencyObject element , SolidColorBrush value )
89
+ {
90
+ element . SetValue ( SwitchTrackOnBackgroundProperty , value ) ;
91
+ }
92
+
93
+ public static SolidColorBrush GetSwitchTrackOnBackground ( DependencyObject element )
94
+ {
95
+ return ( SolidColorBrush ) element . GetValue ( SwitchTrackOnBackgroundProperty ) ;
96
+ }
97
+
98
+ public static DependencyProperty SwitchTrackOffBackgroundProperty =
99
+ DependencyProperty . RegisterAttached (
100
+ "SwitchTrackOffBackground" , typeof ( SolidColorBrush ) , typeof ( ToggleButtonAssist ) ) ;
101
+
102
+ public static void SetSwitchTrackOffBackground ( DependencyObject element , SolidColorBrush value )
103
+ {
104
+ element . SetValue ( SwitchTrackOffBackgroundProperty , value ) ;
105
+ }
106
+
107
+ public static SolidColorBrush GetSwitchTrackOffBackground ( DependencyObject element )
108
+ {
109
+ return ( SolidColorBrush ) element . GetValue ( SwitchTrackOffBackgroundProperty ) ;
79
110
}
80
111
}
81
112
}
0 commit comments