You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally I thought this was a maui bug, and I posted 26620.
It turns out whilst there is merit to that bug, using a hack to create a maui AppThemeBinding actually resolves the functionality problem (however it doesn't address the hole in maui's api...). My sample app used an AppThemeColor to set the normal / disabled states on an Editor.
When using AppThemeColor the behavior is not as expected, the correct colors don't apply and the visual state of the control is left broken...
Instead it applies correctly in xaml, but breaks the appearance when applied through code:
Enabled
Disabled
Expected Behavior
The following code:
VisualStateManager.SetVisualStateGroups(CodeEditor,[newVisualStateGroup(){Name="CommonStates",States={newVisualState(){Name="Normal",Setters={newSetter(){Property=Editor.TextColorProperty,Value=newAppThemeColor(){Light=Colors.Lime,Dark=Colors.Gold,Default=Colors.Lime,},// Value = Colors.Gold,}}},newVisualState(){Name="Disabled",Setters={newSetter(){Property=Editor.TextColorProperty,// Value = Color.FromArgb("#CCAC00"),Value=newAppThemeColor(){Light=Colors.DarkGreen,Dark=Color.FromArgb("#CCAC00"),Default=Colors.DarkGreen,}}}}}}]);
When applied to an Editor should apply a normal & disabled color that is theme aware:
Light Mode Enabled
Light Mode Disabled
Dark Mode Enabled
Dark Mode Disabled
Steps To Reproduce
Apply any code that uses a Setter to a color property and set the value to an AppThemeColor, see my reproduction for more!
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
Originally I thought this was a maui bug, and I posted 26620.
It turns out whilst there is merit to that bug, using a hack to create a maui
AppThemeBinding
actually resolves the functionality problem (however it doesn't address the hole in maui's api...). My sample app used anAppThemeColor
to set the normal / disabled states on anEditor
.When using
AppThemeColor
the behavior is not as expected, the correct colors don't apply and the visual state of the control is left broken...Instead it applies correctly in xaml, but breaks the appearance when applied through code:
Expected Behavior
The following code:
When applied to an
Editor
should apply a normal & disabled color that is theme aware:Steps To Reproduce
Apply any code that uses a
Setter
to a color property and set the value to anAppThemeColor
, see my reproduction for more!Link to public reproduction project repository
https://github.com/Axemasta/MauiRepros/tree/main/src/VisualStateCodeRepro
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: