Export (0) Print
Expand All

RoutedEventArgs.RoutedEvent Property

Gets or sets the RoutedEvent associated with this RoutedEventArgs instance.

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public RoutedEvent RoutedEvent { get; set; }
/** @property */
public RoutedEvent get_RoutedEvent ()

/** @property */
public void set_RoutedEvent (RoutedEvent value)

public function get RoutedEvent () : RoutedEvent

public function set RoutedEvent (value : RoutedEvent)

Members of this class are either not typically used in XAML, or cannot be used in XAML.

Property Value

The identifier for the event that has been invoked.

Exception typeCondition

InvalidOperationException

Attempted to change the RoutedEvent 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 RoutedEvent cannot be a null reference (Nothing in Visual Basic) at any time.

The following example creates new routed event data with an initial constructor and then sets the RoutedEvent property as a subsequent operation. You must have RoutedEvent 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);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft