แก้ไข

แชร์ผ่าน


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.

public:
 RoutedEventArgs();
public RoutedEventArgs ();
Public Sub New ()

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

RoutedEventArgs(RoutedEvent)

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

public:
 RoutedEventArgs(System::Windows::RoutedEvent ^ routedEvent);
public RoutedEventArgs (System.Windows.RoutedEvent routedEvent);
new System.Windows.RoutedEventArgs : System.Windows.RoutedEvent -> System.Windows.RoutedEventArgs
Public Sub New (routedEvent As 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.

void RaiseTapEvent()
{
        RoutedEventArgs newEventArgs = new RoutedEventArgs(MyButtonSimple.TapEvent);
        RaiseEvent(newEventArgs);
}
Private Sub RaiseTapEvent()
    Dim newEventArgs As New RoutedEventArgs(MyButtonSimple.TapEvent)
    MyBase.RaiseEvent(newEventArgs)
End Sub

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

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.

public:
 RoutedEventArgs(System::Windows::RoutedEvent ^ routedEvent, System::Object ^ source);
public RoutedEventArgs (System.Windows.RoutedEvent routedEvent, object source);
new System.Windows.RoutedEventArgs : System.Windows.RoutedEvent * obj -> System.Windows.RoutedEventArgs
Public Sub New (routedEvent As RoutedEvent, source As Object)

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