Skip to content
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

App.xaml setting theme "Dark" inoperative. #935

Open
yxkaibaoma opened this issue Feb 7, 2024 · 1 comment
Open

App.xaml setting theme "Dark" inoperative. #935

yxkaibaoma opened this issue Feb 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@yxkaibaoma
Copy link

Describe the bug

App.xaml
<Application.Resources>

<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>

</Application.Resources>

To Reproduce

image
1707273147270
image
The constructor is called multiple times, causing the theme to reset.

Expected behavior

how to avoid?

Screenshots

No response

OS version

win11

.NET version

.net core 6

WPF-UI NuGet version

3.0.0

Additional context

No response

@yxkaibaoma yxkaibaoma added the bug Something isn't working label Feb 7, 2024
@Palatis
Copy link
Contributor

Palatis commented Feb 9, 2024

do these in your MainWindow constructor, maybe?

public MainWindow(...)
{
    SystemThemeWatcher.Watch(this);
    ApplicationThemeManager.Apply(ApplicationTheme.Dark);
    InitializeComponent();
}

Has to ask the theme watcher to manage the window, i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants