RoutedEventArgs Constructors

Definition

Initializes a new instance of the RoutedEventArgs class.

Overloads

RoutedEventArgs()

Initializes a new instance of the RoutedEventArgs class.

RoutedEventArgs(RoutedEvent)

Initializes a new instance of the RoutedEventArgs class, using the supplied routed event identifier.

RoutedEventArgs(RoutedEvent, Object)

Initializes a new instance of the RoutedEventArgs class, using the supplied routed event identifier, and providing the opportunity to declare a different source for the event.

RoutedEventArgs()

Initializes a new instance of the RoutedEventArgs class.

C#
public RoutedEventArgs();

Remarks

When using this parameterless constructor, all public properties of the new RoutedEventArgs instance assume the following default values:

Null values for Source and OriginalSource only mean that the RoutedEventArgs data makes no attempt to specify the source. When this instance is used in a call to RaiseEvent, the Source and OriginalSource values are populated based on the element that raised the event and are passed on to listeners through the routing.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

RoutedEventArgs(RoutedEvent)

Initializes a new instance of the RoutedEventArgs class, using the supplied routed event identifier.

C#
public RoutedEventArgs(System.Windows.RoutedEvent routedEvent);

Parameters

routedEvent
RoutedEvent

The routed event identifier for this instance of the RoutedEventArgs class.

Examples

The following example constructs a new RoutedEventArgs for use in a call to RaiseEvent.

C#
void RaiseTapEvent()
{
        RoutedEventArgs newEventArgs = new RoutedEventArgs(MyButtonSimple.TapEvent);
        RaiseEvent(newEventArgs);
}

Remarks

When using this overloaded constructor, unspecified properties of the new RoutedEventArgs instance assume the following default values:

Null values for Source and OriginalSource only mean that this RoutedEventArgs makes no attempt to specify the source. When this instance is used in a call to RaiseEvent, the Source and OriginalSource values are populated based on the element that raised the event and are passed on to listeners through the routing.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

RoutedEventArgs(RoutedEvent, Object)

Initializes a new instance of the RoutedEventArgs class, using the supplied routed event identifier, and providing the opportunity to declare a different source for the event.

C#
public RoutedEventArgs(System.Windows.RoutedEvent routedEvent, object source);

Parameters

routedEvent
RoutedEvent

The routed event identifier for this instance of the RoutedEventArgs class.

source
Object

An alternate source that will be reported when the event is handled. This pre-populates the Source property.

Remarks

When using this overloaded constructor, unspecified properties of the new RoutedEventArgs instance assume the following default values:

Null values for OriginalSource are populated based on the element that raised the event and passed on through the routing, but will read null prior to invocation.

Use this signature when passing RoutedEventArgs to virtuals such as OnSelectionChanged, where the arguments are used to call RaiseEvent internally.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10