DataTrigger (Blend SDK for WPF)

You can use the DataTrigger trigger to invoke an action based on the value of a property. If the value specified in the trigger matches a provided value, the trigger invokes any action associated with it. Otherwise, nothing happens.

To add a DataTrigger

  1. In the Assets panel, click Behaviors, and then drag the behavior that you want onto the object that you want to apply the behavior to. The Trigger category appears in the Properties panel.

  2. In the Trigger category, next to TriggerType (EventTrigger), click New. In the Select Object dialog box, click DataTrigger, and then click OK.

    DataTrigger

  3. In the Trigger category, set the following:

    • Binding   Specifies the property binding to monitor for change.

    • Comparison   Specifies the operator that will be used to evaluate the condition for the DataTrigger. The values are as follows:

      • Equal

      • NotEqual

      • LessThan

      • LessThanOrEqual

      • GreaterThan

      • GreaterThanOrEqual

    • Value   Specifies a value to be used in conjunction with the Comparison property. The value is compared to the binding expression specified by the Binding property. The value can be typed directly in the Value text box.