-
-
Notifications
You must be signed in to change notification settings - Fork 910
Description
Is your feature request related to a problem? Please describe
When updating our app from WPF-UI 4.0.2 to 4.1.0 our app suddenly started to pick up system accent color for WPF UI controls despite we previously put effort into blocking it. After investigation the problem turned out to be caused by seemingly unrelated change made in #1413. In that PR FontIcon class started referencing UiApplication.Current.Resources property, which internally initializes a resource dictionary and unconditionally applies system accent color:
wpfui/src/Wpf.Ui/UiApplication.cs
Lines 91 to 99 in a0efc73
| try | |
| { | |
| Wpf.Ui.Appearance.ApplicationAccentColorManager.ApplySystemAccent(); | |
| var themesDictionary = new Markup.ThemesDictionary(); | |
| var controlsDictionary = new Markup.ControlsDictionary(); | |
| _resources.MergedDictionaries.Add(themesDictionary); | |
| _resources.MergedDictionaries.Add(controlsDictionary); | |
| } | |
| catch { } |
In our design system we have fixed color scheme and do not plan do adapt to system accent color. We would like to have a way to disable applying it on startup.
Describe the solution you'd like
Seems like adding a new boolean switch property to UiApplication would be enough:
namespace Wpf.Ui;
public class UiApplication
{
public bool ApplySystemAccentColor { get; set; }
}By setting this property to false before window initialization the color scheme of WPF-UI controls will not be changed according to system accent color
Describe alternatives you've considered
Don't set system accent color upon resource initialization at all since this behavior is not intuitive and leave this decision up to the user. The color can be applied via ApplicationThemeManager as they desire
Additional context
No response