wpf Trigger


Example

The simplest of the five trigger types, the Trigger is responsible for setting properties based on other properties within the same control.

<TextBlock>
    <TextBlock.Style>
        <Style TargetType="{x:Type TextBlock}">
            <Style.Triggers>
                <Trigger Property="Text" Value="Pass">
                    <Setter Property="Foreground" Value="Green"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </TextBlock.Style>
</TextBlock>

In this example, the foreground color of the TextBlock will turn green when it's Text property is equal to the string "Pass".