-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
ThemeVariantScope doesn't refresh resources on first change of RequestedThemeVariant #10201
Comments
Is it pushed to the branch? Theme switch works from the first change in the control catalog which makes it weird. |
Not yet, I'm still cleaning up some of the old theme switch code but I'll try to push something out later this evening. EDIT: Actually I can repro with this simple example in a new Avalonia project (with Avalonia.Themes.Fluent): <Window>
<ThemeVariantScope Name="ThemeScope">
<Button Content="Click Me" />
</ThemeVariantScope>
</Window> var ts = this.FindControl<ThemeVariantScope>("ThemeScope");
KeyDown += (s, e) =>
{
if (e.Key == Key.Space)
{
if (ts.ActualThemeVariant == ThemeVariant.Light)
{
ts.RequestedThemeVariant = ThemeVariant.Dark;
}
else
{
ts.RequestedThemeVariant = ThemeVariant.Light;
}
}
}; Edit again: |
There are a few instances I see where the theme variant isn't being applied correctly. For example, a popup isn't getting it set correctly. And even overlays that were hidden but then changed to visible keep the old theme variant. Doesnt relate exactly to this issue so just FYI. Seems to indicate invalidating is broken or the property isn't (re)applied on visibility changes. |
Describe the bug
In my FluentAvalonia sample app, I have an option to toggle the theme for controls without changing the entire app theme. With the new ThemeVariant stuff, I've added a
ThemeVariantScope
control into the page to keep this behavior. When the theme toggle is requested the first time on the ThemeVariantScope, it doesn't tell the resources to refresh, and requires multiple attempts to get it to apply.Video: (hopefully the clicking comes across) It takes 3 clicks to get the theme change to apply and then it works normally
Media1.mp4
The text was updated successfully, but these errors were encountered: