Theme switching doesn't work properly
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Hello, I am trying to implement a dark theme into my application, but trying to switch themes causes some weird behavior (see clip).
Page.cs:
private async void OnLightThemeRadioButtonChecked(object sender, RoutedEventArgs e)
{
Wpf.Ui.Appearance.ApplicationThemeManager.Apply(Wpf.Ui.Appearance.ApplicationTheme.Light);
}
private async void OnDarkThemeRadioButtonChecked(object sender, RoutedEventArgs e)
{
Wpf.Ui.Appearance.ApplicationThemeManager.Apply(Wpf.Ui.Appearance.ApplicationTheme.Dark);
}
MainWindow.cs:
public MainWindow()
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
InitializeComponent();
}
To Reproduce
Switch themes with Wpf.Ui.Appearance.ApplicationThemeManager.Apply()
Expected behavior
I would expect the themes to simply switch like in the demo app.
Screenshots
https://github.com/user-attachments/assets/c060c449-18ee-4518-b2fd-936ec2c8c94c
OS version
Windows 11 23H2 (Build 22631.3958)
.NET version
.Net 8.0
WPF-UI NuGet version
3.0.5
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior from the Page.cs theme handlers and MainWindow.cs initialization shown in the report, then compare the result with the demo app. Check the documented WPF-UI theme-switching flow for .NET 8 and version 3.0.5; done means switching between Light and Dark produces the same result as the demo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- design, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100