Skip to content

Commit 59082f7

Browse files
committed
Background support for radtio buttons
1 parent b9ec6f7 commit 59082f7

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.RadioButton.xaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
2323
<Setter Property="BorderThickness" Value="1"/>
2424
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
25+
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/>
26+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/>
2527
<Setter Property="Template">
2628
<Setter.Value>
2729
<ControlTemplate TargetType="{x:Type RadioButton}">
@@ -87,7 +89,7 @@
8789
<Trigger Property="IsPressed" Value="true"/>
8890
<Trigger Property="IsChecked" Value="true">
8991
<Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
90-
<Setter Property="Fill" TargetName="Graphic" Value="{DynamicResource PrimaryHueMidBrush}" />
92+
<Setter Property="Fill" TargetName="Graphic" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
9193
</Trigger>
9294
<Trigger Property="IsChecked" Value="{x:Null}">
9395
<Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
@@ -98,4 +100,23 @@
98100
</Setter.Value>
99101
</Setter>
100102
</Style>
101-
</ResourceDictionary>
103+
104+
<Style x:Key="MaterialDesignLightRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
105+
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"/>
106+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}"/>
107+
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueLightForegroundBrush}"/>
108+
</Style>
109+
110+
<Style x:Key="MaterialDesignDarkRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
111+
<Setter Property="Background" Value="{DynamicResource PrimaryHueDarkBrush}"/>
112+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueDarkBrush}"/>
113+
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkForegroundBrush}"/>
114+
</Style>
115+
116+
<Style x:Key="MaterialDesignAccentRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
117+
<Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
118+
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
119+
<Setter Property="Foreground" Value="{DynamicResource SecondaryAccentForegroundBrush}"/>
120+
</Style>
121+
122+
</ResourceDictionary>

0 commit comments

Comments
 (0)