Theming broken in v2.1.0
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
The theming is completely broken for me, I'm seeing some very strange behaviour.
App.xaml - load in dictionaries
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
MainWindow.xaml - define main window with dummy content
<ui:UiWindow x:Class="Test.Client.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Test.Client.Views"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
Title="Test" Height="1200" Width="1800">
<Grid>
<TextBlock Text="hello world" />
</Grid>
</ui:UiWindow>
MainWindowViewModel.cs - basic ViewModel for this example so I can apply some styles
public class MainWindowViewModel : ObservableObject
{
public MainWindowViewModel()
{
Theme.Apply(ThemeType.Dark, BackgroundType.Mica, true);
}
}
So with the above:
Theme.Apply(ThemeType.Dark, BackgroundType.Mica, true);
makes the window completely black, mica background not working
Theme.Apply(ThemeType.Light, BackgroundType.Mica, true);
window still black despite the light theme, even more confusingly, the text has now vanished
Theme.Apply(ThemeType.Dark, BackgroundType.Acrylic, true);
changing to acrylic has no impact
I have tried different combinations of the above, all seem to be broken in some way. As far as I'm aware I have followed the documentation and have my application configured in the correct manner. I am able to place controls from the library onto my window so it's all talking correctly, it just seems to be the theming that's falling over.
To Reproduce
Install library as above, and produce minimal WPF application.
Attempt to apply theming, see broken results.
Expected behavior
Theming applies correctly and background styles work.
Screenshots
See bug report.
OS version
Windows 23H2 (OS Build 22631.3007)
.NET version
.NET 8.0
WPF-UI NuGet version
2.1.0
Additional context
Not sure if it will help pinpointing the issue, but you can see that the window title is also gone in all examples. If I remove the library, it returns.
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 with the minimal setup shown in App.xaml, MainWindow.xaml, and MainWindowViewModel.cs, then reproduce the issue with .NET 8.0 and WPF-UI 2.1.0 on Windows 23H2. Check each Theme.Apply combination and compare the window background, text, title, and mica/acrylic behavior with the expected result.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100