Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get following error: '#FF000000' is not a valid value for Color

Tags:

wpf

I sometime get following error message:

Cannot convert the value in attribute 'Color' to object of type 'System.Windows.Media.Color'. '#FF000000' is not a valid value for property 'Color'. Error at object 'HighlightTextBrush' in markup file

The WPF code for HighlightTextBrush is:

<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" 
  Color="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}" />
like image 989
magol Avatar asked Mar 25 '11 11:03

magol


2 Answers

You are trying to assign a Brush to the Color property. You need to use:

<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}"
    Color="{StaticResource {x:Static SystemColors.ControlTextColorKey}}" />
like image 102
CodeNaked Avatar answered Oct 29 '22 16:10

CodeNaked


I had a problem using CodeNaked's answer where it returned the same error. I used this instead:

<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{Binding Source={x:Static SystemColors.ControlTextColorKey},Path=Color}" />
like image 22
Biggert Avatar answered Oct 29 '22 14:10

Biggert