Change TextBlock Background based on the value of Text
.net-4.0, c#, wpf, xaml
Solution
What about a normal `Trigger`?:
<Style TargetType="TextBlock" x:Key="textBlock">
<Style.Triggers>
<Trigger Property="TextBlock.Text" Value="00:00">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
Problem
I want to change the Background property of a TextBlock if the Text is 00:00.Is there a simple, XAML solution? I've tried creating a DataTrigger but it's not changing the colour ``` <Style TargetType="TextBlock" x:Key="textBlock"> <Style.Triggers> <DataTrigger Binding="{Binding}" Value="00:00"> <Setter Property="Background" Value="Red" /> </DataTrigger> </Style.Triggers> </Style> <TextBlock Text="{Binding}" Margin="3" Style="{DynamicResource textBlock}"/> ```