I got this TextBlock:
<TextBlock Foreground="Red"/>
And there is an implicit style for TextBlock with style trigger that asks "if the foreground is {StaticResource BrushTextBlockAlertForeground} then set the background to black." (BrushTextBlockAlertForeground is Red, of course).
<Trigger Property="Foreground" Value="{StaticResource BrushTextBlockAlertForeground}">
<Setter Property="Background" Value="Black"/>
</Trigger>
This trigger condition fails! If static resource resolved on loading, so why this trigger fails? Shouldn't the XAML loader put there Red in the trigger condition? or it puts some expression instead? Is there any chance that happening because the "Value" property of trigger condition isn't dependency property?
Only when I write
<Trigger Property="Foreground" Value="Red">
<Setter Property="Background" Value="Black"/>
</Trigger>
It works.
If I put static resource from outside (look below), it doesn't work in any case. Like that:
<TextBlock Foreground="{StaticResource BrushTextBlockAlertForeground}"/>
I would love to know the reason behind, because I want to write reusable color, instead of putting "red" in many places. "Tomorrow" someone will try to make that reusable and will encounter the behavior I experiencing.
Backgroundis changed toBlack. - XAMlMAX