Represents a trigger that applies property values or performs actions conditionally.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
WPF defines properties that correspond to end-user actions, such as the IsMouseOver property that is set to true when the user hovers the cursor over a UIElement or the corresponding IsMouseOver property of a ContentElement. Representing end-user actions in property values, along with the element, allows WPF styles to change property values based on those end-user actions, all from within markup.
The properties changed by triggers are automatically reset to their previous value when the triggered condition is no longer satisfied. Triggers are optimized for transient states which are expected to change and return to original state, such as IsPressed on Button and IsSelected on ListBoxItem. The Property of interest must be a dependency property.
The Setters property of a object can only consist of Setter objects. Adding a Setter child to a object implicitly adds it to the SetterBaseCollection for the object. EventSetter objects are not supported; only Style.Setters supports EventSetter objects.
There are other types of triggers. MultiTrigger allows you to apply changes based on the state of multiple properties. EventTrigger allows you to apply changes when an event occurs. DataTrigger and MultiDataTrigger are for data-bound properties.
|How to: Trigger an Animation When a Property Value Changes||This example shows how to use a to start a Storyboard when a property value changes. You can use a inside a Style, ControlTemplate, or DataTemplate.|
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.