Skip to main content
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the associated with this RoutedEventArgs instance.

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

public RoutedEvent RoutedEvent { get; set; }
public:
property RoutedEvent^ RoutedEvent {
	RoutedEvent^ get();
	void set(RoutedEvent^ value);
}
member RoutedEvent : RoutedEvent with get, set
Public Property RoutedEvent As RoutedEvent

Property Value

Type:

The identifier for the event that has been invoked.

Exception Condition
InvalidOperationException

Attempted to change the value while the event is being routed.

You cannot set this value on a RoutedEventArgs that has already been routed (for instance, if you obtained the arguments through a handler). Attempting to do so will generate an exception. You can only set it on an instance that has not yet been used to generate an invocation of the event.

The value of cannot be null at any time.

The following example creates new routed event data with an initial constructor and then sets the property as a subsequent operation. You must have set prior to raising the routed event.

protected virtual void OnSelectedColorChanged(Color oldColor, Color newColor)
{

    RoutedPropertyChangedEventArgs<Color> newEventArgs =
        new RoutedPropertyChangedEventArgs<Color>(oldColor, newColor);
    newEventArgs.RoutedEvent = ColorPicker.SelectedColorChangedEvent;
    RaiseEvent(newEventArgs);
}
Protected Overridable Sub OnSelectedColorChanged(ByVal oldColor As Color, ByVal newColor As Color)

	Dim newEventArgs As New RoutedPropertyChangedEventArgs(Of Color)(oldColor, newColor)
	newEventArgs.RoutedEvent = ColorPicker.SelectedColorChangedEvent
	MyBase.RaiseEvent(newEventArgs)
End Sub
.NET Framework
Available since 3.0
Return to top