Style.Triggers Property


Gets a collection of TriggerBase objects that apply property values based on specified conditions.

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public TriggerCollection Triggers { get; }

Property Value

Type: System.Windows.TriggerCollection

A collection of TriggerBase objects. The default is an empty collection.

The WPF styling and templating model enables you to specify triggers within your Style. Essentially, triggers are objects that enable you to apply changes when certain conditions (such as when a certain property value becomes true, or when an event occurs) are satisfied.



Zero or more object elements that are classes deriving from TriggerBase.

The following example shows a named Style available to Button controls. The Style defines a Trigger element that changes the Foreground property of a button when the IsPressed property is true.

<Style x:Key="Triggers" TargetType="Button">
    <Trigger Property="IsPressed" Value="true">
        <Setter Property = "Foreground" Value="Green"/>

.NET Framework
Available since 3.0
Return to top