Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

In Resource Dictionary, how to specify color based on defined color?

$
0
0

I think this is an easy question. Given I have a resource dictionary with the following:

<Color x:Key="NormalBackgroundColor">#D5DAE8</Color><Color x:Key="NormalForegroundColor">Black</Color>

and I want to define an Error background that is the same and normal, but foreground that is different (Say Red).  How can I specify that the ErrorBackgroundColor is the same as the NormalBackgroundColor (without using the same value...) So if I subsequently change the NormalBackgroundColor, the ErrorBackgroundColor also changes?

i.e.:

<Color x:Key="ErrorBackgroundColor"><Binding Path="{DynamicResource BackgroundColor1}" /></Color><Color x:Key="ErrorForegroundColor">Red</Color>

The above doesn't work. What do I need to change so that both BackgroundColor values are the same (again without hard coding the 2nd value)?

Thanks


me (and yes, I DO mark correct answers)


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>