[Bug] ui:Button Appearance="Primary" is transparent when resources are defined in FluentWindow instead of App.xaml
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
When using the latest version of Wpf.Ui (lepoco) in a .NET 10 WPF application, setting the Appearance property of a ui:Button to Primary renders the button as completely transparent.
Interestingly, other appearance types seem to render correctly, and the issue only occurs if the required ResourceDictionary merged dictionaries are defined locally within <ui:FluentWindow.Resources>. If the exact same resource dictionaries are moved to App.xaml, the Primary button style loads and renders as expected.
To Reproduce
Steps to reproduce the behavior:
- Create a brand new WPF Application targeting .NET 10.
- Install the latest version of the
Wpf.UiNuGet package. - Leave
App.xaml/App.xaml.csuntouched (with no localWpf.Uiresource dictionaries). - Update
MainWindow.xamlto useui:FluentWindowand define the resources locally as follows:
<ui:FluentWindow
x:Class="WpfApp7.MainWindow"
xmlns="[http://schemas.microsoft.com/winfx/2006/xaml/presentation](http://schemas.microsoft.com/winfx/2006/xaml/presentation)"
xmlns:x="[http://schemas.microsoft.com/winfx/2006/xaml](http://schemas.microsoft.com/winfx/2006/xaml)"
xmlns:d="[http://schemas.microsoft.com/expression/blend/2008](http://schemas.microsoft.com/expression/blend/2008)"
xmlns:local="clr-namespace:WpfApp7"
xmlns:mc="[http://schemas.openxmlformats.org/markup-compatibility/2006](http://schemas.openxmlformats.org/markup-compatibility/2006)"
xmlns:ui="[http://schemas.lepo.co/wpfui/2022/xaml](http://schemas.lepo.co/wpfui/2022/xaml)"
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<ui:FluentWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Light" />
<ui:ControlsDictionary />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/Button/Button.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ui:FluentWindow.Resources>
<Grid>
<ui:TitleBar />
<ui:Button
Width="100"
Height="30"
Appearance="Primary"
Content="Test Button" />
</Grid>
</ui:FluentWindow>
- Run the application.
- Observe that the
ui:Buttonis transparent/invisible, even though it should display with the primary theme color.
Expected behavior
Expect button color to be blue when Primary is selected
Screenshots
OS version
Windows 10
.NET version
10
WPF-UI NuGet version
4.3.0
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 with the MainWindow.xaml reproduction and compare the local FluentWindow.Resources dictionaries with the empty App.xaml setup. Inspect the referenced Wpf.Ui Button.xaml resource and the ThemesDictionary and ControlsDictionary entries, then verify the Primary button renders with its expected blue color when resources remain local.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100