When theme is switched at runtime, it does not apply to visual states of controls - for example button pressed.
New theme should apply everywhere.
When theme
Consider the following page content:
<Grid x:Name="Grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button x:Name="Button">Click</Button>
</Grid>
And make sure App.xaml has no RequestedTheme set:
Application
x:Class="SamplesApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Run the app on Android in light theme, then switch to dark theme via the action center. Notice the page changes background and button changes its colors. However, when the button is pressed it "disappears" because it still uses the "light" theme of pressed visual state.
Nuget Package:
Package Version(s):
Affected platform(s):
Visual Studio:
Relevant plugins:
This is probably for @davidjohnoliver 馃槆
Seems that it is not only with visual states - with the Messages sample app (https://github.com/MartinZikmund/messages-multiplatform-uno-sample) I have noticed that changing theme at runtime does not apply new text color to the "Messages" header on the right pane - I think I saw it on Android specifically. Also theme change at runtime on macOS seemed to crash the app, but I have a feeling that is a problem on my side :-D .
GitHub
Contribute to MartinZikmund/messages-multiplatform-uno-sample development by creating an account on GitHub.
if you have a stack trace to share, that may help for similar issues.
I rushed as it was like 2 AM so I did not capture it, but will retry and find it 馃憤
Seems that it is not only with visual states - with the Messages sample app (https://github.com/MartinZikmund/messages-multiplatform-uno-sample) I have noticed that changing theme at runtime does not apply new text color to the "Messages" header on the right pane - I think I saw it on Android specifically.
Thanks for the poke Martin! Any idea why that text header might be failing to update? I know I missed the visual-state case, but it seems like there's another case I missed as well.
GitHub
Contribute to MartinZikmund/messages-multiplatform-uno-sample development by creating an account on GitHub.
@davidjohnoliver Really hard to say, I just noticed that while most texts changed, this one didn't unless I restarted the app. I will check again later to confirm if I just didn't miss something.