Home > other >  WPF Change or Override Default System Colors
WPF Change or Override Default System Colors

Time:12-08

I researched this in this site and others for a long time, but came empty.

IDE: VS2022. OS: Windows 11. App: WPF .NET 6 (core) C# T-SQL

I'm trying to change the default blue system colors in a ResourceDictionary.

I can successfully change all text colors using this XAML code in the resource dictionary:

<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Red" />

I want to change all the default blue colors to red, like the border color when hovering a TextBox, a ComboBox, and a PasswordBox, plus the highlight color of all controls.

I can do so using Styles, but this will require me to change the Style of all controls.

Is there an easier way to do so like changing or overriding the system colors?

CodePudding user response:

Is there an easier way to do so like changing or overriding the system colors?

No, not really.

Each control has its own default style and template that may or may not use the system colours. It differs from case to case so you may need to define a custom style or template for each control that you want to modify the appearance of.

There is no such thing as one "default blue colour" in WPF.

  • Related