-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[MacOS/iOS] Fixed incorrect color of RadioButton in Dark Mode using Default Control Template. #13215
[MacOS/iOS] Fixed incorrect color of RadioButton in Dark Mode using Default Control Template. #13215
Conversation
…kThemeColor into BuildDefaultTemplate() in order for correct colors to display when MacOS/iOS is in Dark Mode.
src/Controls/src/Core/HandlerImpl/RadioButton/RadioButton.Tizen.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/HandlerImpl/RadioButton/RadioButton.Tizen.cs
Outdated
Show resolved
Hide resolved
Thank you for your pull request. We are auto-formating your source code to follow our code guidelines. |
I implemented requested changes for outer ellipse as well as the checkmark. I also brought the changes over to the Tizen version, although I'm not a fan of repeating stuff across two files :( |
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, lets try to have the smaller number of strings in the assembly.
src/Controls/src/Core/HandlerImpl/RadioButton/RadioButton.Tizen.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/HandlerImpl/RadioButton/RadioButton.Tizen.cs
Outdated
Show resolved
Hide resolved
// First, Light/Dark App themes for outer ellipse, then for the check mark. | ||
// Then check for older themecolor. | ||
// If nothing set, use the defaults for light/dark mode. | ||
if (Application.Current.TryGetResource(RadioButtonOuterEllipseStrokeLight, out var outerLight) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize it's a bit funky because of needing to test that old key. Is there a way we can consolidate this and the similar code below this block into an extension method?
if (normalEllipse.TrySetAppTheme(
lightResourceKey: RadioButtonOuterEllipseStrokeLight,
darkResourceKey: RadioButtonOuterEllipseStrokeDark,
bindableProperty: Ellipse.StrokeProperty,
defaultDark: SolidColorBrush.Black,
defaultLight: SolidColorBrush.White,
out var outerLight,
out var outerDark))
I also wonder if we want to make this if statement an OR
vs an AND
.
If the user has only specified RadioButtonOuterEllipseStrokeLight
then we probably still want this logic to run and then we'd just set the other side of the AppThemeBinding
to whatever the default is?
I see this issue is related to color things, so maybe this is useful to test as well. #12805 |
…, TrySetDynamicTheme, TrySetFill. Updated RadioButton code to use those methods. Removed old ResolveThemeColor method.
BindableProperty bindableProperty, | ||
out object outerColor) | ||
{ | ||
if (Application.Current.TryGetResource(resourceKey, out outerColor)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StephaneDelcroix is this the best way to retrieve this resource? It seems like we'd retrieve the static resource once the DataTemplate is realized and added to the visual tree, that way it can check all the merged dictionaries?
Like, ideally this could use
radioButton.TryGetResource
right? That way if the resources are specified on the page or the RadioButton
itself they'll work?
Just not sure off hand how to do that in the code.
…ns, updated RadioButton
…fs from unshipped api files
Could you also merge the fix for .net 7.0? |
Description of Change
The border color and fill colors of the RadioButton were not being resolved correctly due to it being unable to determine the application's current theme. I moved their initialization to the method where the ellipses are drawn.
Added test CorrectDefaultRadioButtonThemeColorsInLightAndDarkModes in AppThemeTests to validate that the Default Control Template for RadioButton was indeed producing the correct colors in light mode and dark mode.
Issues Fixed
Fixes #5931