#130 – WPF Supports Three Types of Triggers
November 19, 2010 2 Comments
WPF supports three different types of triggers:
- Property triggers
- Fire when the value of a dependency property changes
- Specifies trigger property using property name
- Actions
- Setter elements set values for one or more dependency properties
- One or more TriggerAction classes fire, when trigger becomes active or becomes inactive
- Data triggers
- Fire when the value of a CLR property changes
- Specifies property using Binding keyword
- Actions
- Setter elements sets values for one or more dependency properties
- One or more TriggerAction classes fire, when trigger becomes active or becomes inactive
- Event triggers
- Fire when a routed event is raised
- Action: Class that derives from TriggerAction fires, e.g. BeginStoryboard or SoundPlayerAction
- Often used for animations
Property and data triggers can also support the same kind of actions as event triggers using their EnterAction and ExitAction properties
Thank you–I missed that when reading up on property and data triggers. I’ve updated the post to reflect this.