I want to change the background color of button to system color. Just like I am changing the button color
button2.Background = Brushes.Blue;
to blue. But no I want to Change the color to system color.
I want to change the background color of button to system color. Just like I am changing the button color
button2.Background = Brushes.Blue;
to blue. But no I want to Change the color to system color.
You can get system color from System.Windows.SystemColors
button2.Background = System.Windows.SystemColors.MenuHighlightBrush;
WPF Background is of type System.Windows.Media.Brush. You can set another color like this:
// using System.Windows.Media;
button2.Background = Brushes.White;
button2.Background = new SolidColorBrush(Color.White);
button2.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0, 0);
Background is of type Brush. But you can create a solid brush out of the system color and use that.
SolidBrush systemColorBrush = new SolidBrush(systemColor); // Create SolidBrush from color
button2.Background = systemColorBrush;
You can try something like:
button2.Background = SystemColors.ActiveCaptionBrush;
SystemColors belong to the System.Windows namespace.