0

I'd like to do something like this in my xaml ResourceDictionary:

 <Color x:Key="ForegroundTextColor" > {DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowTextBrushKey}} </Color>

But Color accept as value only stuff like #xxxxx.

Any idea to reach my goal?

Thanks!

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
ff8mania
  • 1,553
  • 3
  • 19
  • 28

1 Answers1

1

Color are not dynamic but you can use a SolidColorBrush, not really a color but something who accepts Color and allows you to use to fill in Rectangle, Background,...

<SolidColorBrush x:Key="MyColor" Color="{DynamicResource MyDynamicResource}" />
Niels
  • 620
  • 4
  • 13
  • Can I use the solidcolorbrush in Text, Border etc etc? – ff8mania Oct 31 '13 at 17:04
  • Sure :) example: – Niels Oct 31 '13 at 17:06
  • Unfortunately it is not working at all: I receive the error: The resource ... cannot be resolved :( – ff8mania Oct 31 '13 at 17:18
  • The problem is with your x:Static vs_shell:... value not with the dynamic one. Your value is static by name so I don't understand what you try to do :/ – Niels Oct 31 '13 at 17:35
  • I'm simply trying to catch the color from the current theme set for visual studio (I'm developing an isolated shell) – ff8mania Nov 01 '13 at 09:03
  • and this color is static, if you change the color theme, you will need to restart tout shell. You can't have a dynamic "link" on it :( – Niels Nov 01 '13 at 10:26