Skip to content

Commit

Permalink
RadioButton Default Template Fill Theme Fix and new Theme Colors for …
Browse files Browse the repository at this point in the history
…Samples app (#14117)

* Fixed issue where fill property was not populating from ResourceDictionary. Added Light/Dark theme colors for RadioButton components to AppResources of sample app to visually demonstrate

* Removed old RadioButtonThemeColors from AppResources of Sample gallery
  • Loading branch information
dustin-wojciechowski committed Mar 28, 2023
1 parent f0039e3 commit f3903b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/Controls/samples/Controls.Sample/AppResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
<Color x:Key="DarkTextSecondaryColor">#f5f5f5</Color>
<Color x:Key="DarkBorderColor">#fefefe</Color>

<!--Individual Dark/Light Theme colors for RadioButton Components -->
<SolidColorBrush x:Key="RadioButtonOuterEllipseStrokeLight">#5639b0</SolidColorBrush>
<SolidColorBrush x:Key="RadioButtonOuterEllipseStrokeDark">#7e2bea</SolidColorBrush>
<SolidColorBrush x:Key="RadioButtonCheckGlyphStrokeLight">#5639b0</SolidColorBrush>
<SolidColorBrush x:Key="RadioButtonCheckGlyphStrokeDark">#7e2bea</SolidColorBrush>
<SolidColorBrush x:Key="RadioButtonCheckGlyphFillLight">#5639b0</SolidColorBrush>
<SolidColorBrush x:Key="RadioButtonCheckGlyphFillDark">#7e2bea</SolidColorBrush>

<!-- STYLES -->
<Style x:Key="SearchBorderStyle" TargetType="Frame">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource LightBackgroundSecondaryColor}, Dark={StaticResource DarkBackgroundSecondaryColor}}" />
Expand Down
8 changes: 5 additions & 3 deletions src/Controls/src/Core/RadioButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ static View BuildDefaultTemplate()
object outerEllipseVisualStateDark = null;
object checkMarkVisualStateLight = null;
object checkMarkVisualStateDark = null;
object checkMarkFillVisualStateLight = null;
object checkMarkFillVisualStateDark = null;

if (!normalEllipse.TrySetDynamicThemeColor(
RadioButtonThemeColor,
Expand Down Expand Up @@ -568,8 +570,8 @@ static View BuildDefaultTemplate()
Ellipse.FillProperty,
SolidColorBrush.White,
SolidColorBrush.Black,
out _,
out _);
out checkMarkFillVisualStateLight,
out checkMarkFillVisualStateDark);
}

contentPresenter.SetBinding(MarginProperty, new Binding("Padding", source: RelativeBindingSource.TemplatedParent));
Expand Down Expand Up @@ -620,7 +622,7 @@ static View BuildDefaultTemplate()
{
Property = Shape.FillProperty,
TargetName = CheckedIndicator,
Value = dynamicCheckMarkThemeColor is not null ? dynamicCheckMarkThemeColor : new AppThemeBinding() { Light = checkMarkVisualStateLight, Dark = checkMarkVisualStateDark }
Value = dynamicCheckMarkThemeColor is not null ? dynamicCheckMarkThemeColor : new AppThemeBinding() { Light = checkMarkFillVisualStateLight, Dark = checkMarkFillVisualStateDark }
});
checkedStates.States.Add(checkedVisualState);

Expand Down

0 comments on commit f3903b9

Please sign in to comment.