lepoco / lepoco/wpfui

[Bug] ui:Button Appearance="Primary" is transparent when resources are defined in FluentWindow instead of App.xaml

Open
#1,732 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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:

  1. Create a brand new WPF Application targeting .NET 10.
  2. Install the latest version of the Wpf.Ui NuGet package.
  3. Leave App.xaml / App.xaml.cs untouched (with no local Wpf.Ui resource dictionaries).
  4. Update MainWindow.xaml to use ui:FluentWindow and 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>
  1. Run the application.
  2. Observe that the ui:Button is 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
Image
OS version

Windows 10

.NET version

10

WPF-UI NuGet version

4.3.0

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.