WPF - How to use SystemColor in C#

71 views Asked by At

I want to use the systemcolor in my design that is used for the hover state of a button. In my image below, you can see the light blue color that is displayed when the user hovers above the "Find and Replace" button. I want to set this color programmatically, so I am trying to set the color from C#. However, when I try to get the RGB values from SystemColors.Highlight the color is wrong. You can see the color used on the "Projects" button below.

Highlight SystemColor compared to displayed highlight color

byte r = SystemColors.Highlight.R;
byte g = SystemColors.Highlight.G;
byte b = SystemColors.Highlight.B;
1

There are 1 answers

1
Parth Mehta On
btnUp.Background = new SolidColorBrush(Color.FromRgb(0,0,0));

try this.