lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.74k stars 756 forks source link

Theme switching doesn't work properly #1193

Open JellyBelly1809 opened 3 months ago

JellyBelly1809 commented 3 months ago

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