Skip to content

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

Description

@ValeriyLappo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions