diff --git a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml index 2429ef3afd..eab700fdcb 100644 --- a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml +++ b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml @@ -119,7 +119,12 @@ - + + + + - + diff --git a/src/MaterialDesignThemes.Wpf/CheckBoxAssist.cs b/src/MaterialDesignThemes.Wpf/CheckBoxAssist.cs index 529a1a293c..8b3d9d8001 100644 --- a/src/MaterialDesignThemes.Wpf/CheckBoxAssist.cs +++ b/src/MaterialDesignThemes.Wpf/CheckBoxAssist.cs @@ -1,3 +1,5 @@ +using System.Windows.Media; + namespace MaterialDesignThemes.Wpf; public class CheckBoxAssist @@ -5,10 +7,31 @@ public class CheckBoxAssist private const double DefaultCheckBoxSize = 18.0; #region AttachedProperty : CheckBoxSizeProperty - public static readonly DependencyProperty CheckBoxSizeProperty - = DependencyProperty.RegisterAttached("CheckBoxSize", typeof(double), typeof(CheckBoxAssist), new PropertyMetadata(DefaultCheckBoxSize)); + public static readonly DependencyProperty CheckBoxSizeProperty = DependencyProperty.RegisterAttached( + "CheckBoxSize", + typeof(double), + typeof(CheckBoxAssist), + new PropertyMetadata(DefaultCheckBoxSize) + ); public static double GetCheckBoxSize(CheckBox element) => (double)element.GetValue(CheckBoxSizeProperty); + public static void SetCheckBoxSize(CheckBox element, double checkBoxSize) => element.SetValue(CheckBoxSizeProperty, checkBoxSize); #endregion + + + + #region AttachedProperty : CheckBoxForegroundProperty + public static readonly DependencyProperty CheckBoxForegroundProperty = DependencyProperty.RegisterAttached( + "CheckBoxForeground", + typeof(Brush), + typeof(CheckBoxAssist), + null + ); + + public static Brush GetCheckBoxForeground(CheckBox element) => (Brush)element.GetValue(CheckBoxForegroundProperty); + + public static void SetCheckBoxForeground(CheckBox element, Brush checkBoxForeground) => + element.SetValue(CheckBoxForegroundProperty, checkBoxForeground); + #endregion } diff --git a/src/MaterialDesignThemes.Wpf/RadioButtonAssist.cs b/src/MaterialDesignThemes.Wpf/RadioButtonAssist.cs index c36cf7e677..52d17be942 100644 --- a/src/MaterialDesignThemes.Wpf/RadioButtonAssist.cs +++ b/src/MaterialDesignThemes.Wpf/RadioButtonAssist.cs @@ -1,23 +1,37 @@ -namespace MaterialDesignThemes.Wpf +using System.Windows.Media; + +namespace MaterialDesignThemes.Wpf { public class RadioButtonAssist { private const double DefaultRadioButtonSize = 18.0; #region AttachedProperty : RadioButtonSizeProperty - public static readonly DependencyProperty RadioButtonSizeProperty = - DependencyProperty.RegisterAttached( - "RadioButtonSize", - typeof(double), - typeof(RadioButtonAssist), - new PropertyMetadata(DefaultRadioButtonSize) - ); + public static readonly DependencyProperty RadioButtonSizeProperty = DependencyProperty.RegisterAttached( + "RadioButtonSize", + typeof(double), + typeof(RadioButtonAssist), + new PropertyMetadata(DefaultRadioButtonSize) + ); + + public static double GetRadioButtonSize(RadioButton element) => (double)element.GetValue(RadioButtonSizeProperty); + + public static void SetRadioButtonSize(RadioButton element, double RadioButtonSize) => + element.SetValue(RadioButtonSizeProperty, RadioButtonSize); + #endregion + + #region AttachedProperty :RadioButtonForegroundProperty + public static readonly DependencyProperty RadioButtonForegroundProperty = DependencyProperty.RegisterAttached( + "RadioButtonForeground", + typeof(Brush), + typeof(RadioButtonAssist), + null + ); - public static double GetRadioButtonSize(RadioButton element) => - (double)element.GetValue(RadioButtonSizeProperty); + public static Brush GetRadioButtonForeground(RadioButton element) => (Brush)element.GetValue(RadioButtonForegroundProperty); - public static void SetRadioButtonSize(RadioButton element, double checkBoxSize) => - element.SetValue(RadioButtonSizeProperty, checkBoxSize); + public static void SetRadioButtonForeground(RadioButton element, Brush radioButtonForeground) => + element.SetValue(RadioButtonForegroundProperty, radioButtonForeground); #endregion } } diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.CheckBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.CheckBox.xaml index 281366a6e7..7d105b325f 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.CheckBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.CheckBox.xaml @@ -70,6 +70,7 @@ + @@ -111,13 +112,13 @@ + Fill="{Binding RelativeSource={RelativeSource TemplatedParent} ,Path=(wpf:CheckBoxAssist.CheckBoxForeground)}" /> @@ -158,7 +159,7 @@ - + @@ -205,6 +206,7 @@ + @@ -246,13 +248,13 @@ + Fill="{Binding RelativeSource={RelativeSource TemplatedParent} ,Path=(wpf:CheckBoxAssist.CheckBoxForeground)}" /> diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml index 00df04c542..fd5a507d9d 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml @@ -41,6 +41,7 @@ + @@ -81,14 +82,14 @@ + Fill="{Binding RelativeSource={RelativeSource TemplatedParent} ,Path=(wpf:RadioButtonAssist.RadioButtonForeground)}" /> @@ -126,7 +127,7 @@ - + @@ -209,14 +210,14 @@ + Fill="{Binding RelativeSource={RelativeSource TemplatedParent} ,Path=(wpf:RadioButtonAssist.RadioButtonForeground)}" />