Skip to content

Instantly share code, notes, and snippets.

@yukitos
Created June 25, 2014 06:42
Show Gist options
  • Save yukitos/7e417f082b083c0fea72 to your computer and use it in GitHub Desktop.
Save yukitos/7e417f082b083c0fea72 to your computer and use it in GitHub Desktop.
Set GridViewColumn's text color red if binding 'Result' property equals 'Error'.
<!-- (snip) -->
<GridViewColumn Header="Result" DisplayMemberBinding="{Binding Result}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding}" Value="Error"/>
</MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="Red"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<!-- (snip) -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment