Reputation: 11
I am new to WPF and having trouble with something rather simple. I have set the background colour of my button like this:
<Button Background="FF0000"/>
I keep getting this error:
Invalid value for property 'Background': 'FF0000'
Also, if anyone knew the hex code of the background colour in the image below, or how to find it, that would be much appreciated.
Upvotes: 0
Views: 134
Reputation: 22089
You have to add a pound sign in front of the hex color code. For more information, you can refer to the documentation for SoliColorBrush
and XAML attribute usage.
<Button Background="#FF0000"/>
The background color can be found by using an image editor, it is #393943
.
<Button Background="#393943"/>
See this related Super User question for a variety of ways to pick a color from an image.
Upvotes: 1