當 TextBlock 繫結的值 IsChek=1 時顯示為“是”;IsCheck=2 時顯示為“否”,同時設定文字顏色為紅色
<TextBlock FontWeight="Bold" VerticalAlignment="Center"> <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding IsCheck}" Value="1"> <Setter Property="Text" Value="是"/> </DataTrigger> <DataTrigger Binding="{Binding IsCheck}" Value="2"> <Setter Property="Text" Value="否"/> <Setter Property="Foreground" Value="Red"/> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock>