Raise Event(RoutedEventArgs) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
virtual void RaiseEvent(System::Windows::RoutedEventArgs ^ e);
public void RaiseEvent (System.Windows.RoutedEventArgs e);
abstract member RaiseEvent : System.Windows.RoutedEventArgs -> unit
override this.RaiseEvent : System.Windows.RoutedEventArgs -> unit
Public Sub RaiseEvent (e As RoutedEventArgs)
A RoutedEventArgs that contains the event data and also identifies the event to raise.
The following example creates event data, appends the event identifier to the data, and then uses the event data instance to raise a custom routed event.
RoutedEventArgs newEventArgs = new RoutedEventArgs(MyButtonSimple.TapEvent);
Private Sub RaiseTapEvent()
Dim newEventArgs As New RoutedEventArgs(MyButtonSimple.TapEvent)
e parameter is typed as the common base type for all routed event data; however, the event data should be given as the most specific event data type that is available for the event being raised, because RoutedEventArgs derived classes contain the actual specific data properties that are intended for the specific event when it is raised.
RoutedEventArgs is not just the state properties for the event; it also identifies which routed event to raise. This event-raising pattern and the routed event data both differ from common language runtime (CLR) events and data classes, which typically just contain properties that are related to the event.