RoutedEventArgs.RoutedEvent RoutedEventArgs.RoutedEvent RoutedEventArgs.RoutedEvent RoutedEventArgs.RoutedEvent Property

定義

この RoutedEventArgs インスタンスに関連付けられている RoutedEvent を取得または設定します。Gets or sets the RoutedEvent associated with this RoutedEventArgs instance.

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

プロパティ値

呼び出されたイベントの識別子。The identifier for the event that has been invoked.

例外

イベントのルーティング中に RoutedEvent 値を変更しようとしました。Attempted to change the RoutedEvent value while the event is being routed.

次の例は、最初のコンス トラクターを持つ新しいルーティング イベントのデータを作成し、設定、RoutedEventプロパティを後続の操作として。The following example creates new routed event data with an initial constructor and then sets the RoutedEvent property as a subsequent operation. 必要がありますRoutedEventルーティング イベントを発生させる前に設定します。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);
}
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

注釈

この値を設定することはできません、RoutedEventArgsが既にルーティングされている (たとえば、ハンドラーを引数を取得した) 場合。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.

RoutedEventすることはできませんnullいつでもできます。The value of RoutedEvent cannot be null at any time.

適用対象