Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButton Default Template Fill Theme Fix and new Theme Colors for Samples app #14117

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 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,18 @@
<Color x:Key="DarkTextSecondaryColor">#f5f5f5</Color>
<Color x:Key="DarkBorderColor">#fefefe</Color>

<!-- Older Dynamic Themes for RadioButtons -->
<!--<Color x:Key="RadioButtonThemeColor">#5639b0</Color>-->
<!--<Color x:Key="RadioButtonCheckMarkThemeColor">#7e2bea</Color>-->
dustin-wojciechowski marked this conversation as resolved.
Show resolved Hide resolved

<!--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