lepoco / lepoco/wpfui

ApplicationAccentColorManager.Apply not applying colour passed

Open
#1,203 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 ApplicationAccentColorManager it seems it does not use the colour passed to it.

To Reproduce
  • Create a brand new WPF application
  • In MainWindow.xaml.cs
 public MainWindow()
    {
        ApplicationAccentColorManager.Apply(
            Color.FromRgb(25, 97, 55), // Green
            ApplicationTheme.Light,
            false
        );
        
        InitializeComponent();
       
    }
  • In MainWindow.xaml
<Window x:Class="WpfApp1.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:WpfApp1"
        xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    
    <Window.Resources>
        <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ui:ThemesDictionary Theme="Light" />
                    <ui:ControlsDictionary />
                </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <StackPanel>
        <CheckBox Content="Hello"></CheckBox>
        <ui:Button Appearance="Primary" Content="Hello WPF!"></ui:Button>
    </StackPanel>
</Window>

Checkbox when clicked is light blue, button even though set to primary is light blue, i would expect both to be green

Expected behavior

I would expect both the checkbox and the button to have the green colour i passed to the manager

Screenshots

image
image

OS version

Windows 11

.NET version

.Net 4.8.1, .Net Core 8

WPF-UI NuGet version

3.0.5, 3.0.4

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 ApplicationAccentColorManager.Apply call shown in MainWindow.xaml.cs and compare it with the theme resources declared in MainWindow.xaml. Reproduce the issue in the stated .NET/WPF versions, then verify that the checkbox and Primary button use the supplied green accent instead of light blue.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.