EventTrigger::RoutedEvent Property
Gets or sets the RoutedEvent that will activate this trigger.
Assembly: PresentationFramework (in PresentationFramework.dll)
public: property RoutedEvent^ RoutedEvent { RoutedEvent^ get(); void set(RoutedEvent^ value); }
| Exception | Condition |
|---|---|
| ArgumentNullException | The RoutedEvent property cannot be null. |
EventTriggers apply a set of actions when the specified routed event occurs. For example, you may want to use EventTriggers to start a set of animations when the mouse pointer is over a certain user interface (UI) control.
If the template or style that contains this EventTrigger does not have the TargetType property specified, then you need to quality the event name with the class name using the ClassName.EventName syntax.
EventTrigger objects cannot handle events that have already been Handled. Controls such as Button or TextBox perform specific actions on user input events such as mouse clicks and keyboard events. For example, if you are styling a button and try to set the MouseDown event as the RoutedEvent of an EventTrigger, the EventTrigger never gets applied because the event first gets handled by the button. Instead, you can use the PreviewMouseDown event or a different event.
When using data binding, if you are using the TargetUpdated event, you must set the NotifyOnTargetUpdated value of your Binding object to true for the event to be raised.
This example shows how to use event triggers in a style to animate the MouseEnter and MouseLeave events of a FrameworkElement. In this example, the Style has the TargetType set to Rectangle. Therefore, there is no need to qualify the MouseEnter and MouseLeave event names with the class name.
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0