次の方法で共有


ExecutedRoutedEventArgs.Parameter プロパティ

定義

コマンドのデータ パラメーターを取得します。

public:
 property System::Object ^ Parameter { System::Object ^ get(); };
public object Parameter { get; }
member this.Parameter : obj
Public ReadOnly Property Parameter As Object

プロパティ値

コマンド固有のデータ。 既定値は null です。

次の例では、カスタム RoutedCommandExecutedRoutedEventHandlerを作成します。 ハンドラーは、ExecutedRoutedEventArgs.Parameterを介してハンドラーに渡されるSlider コントロールの現在の時刻とValue プロパティを使用してTextBoxを更新します。

//  Executed Event Handler
//
//  Updates the output TextBox with the current seconds 
//  and the target second, which is passed through Args.Parameter.
private void CustomCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
    txtResults.Text = "Command Executed at " +
        DateTime.Now.Second + " seconds after the minute \n\n" +
        "The target second is set to " +
        e.Parameter;
}
'  Executed Event Handler
'
'  Updates the output TextBox with the current seconds 
'  and the target second, which is passed through Args.Parameter.
Private Sub CustomCommandExecuted(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
    txtResults.Text = "Command Executed at " & Date.Now.Second & " seconds after the minute " & vbLf & vbLf & "The target second is set to " & e.Parameter.ToString()
End Sub

注釈

このプロパティは、特定のコマンドによって定義されるジェネリック データ パラメーターを表します。

このパラメーターが必要ない場合は、 null を渡すことができます。

通常、 Parameter は、実行時に特定の情報をコマンドに渡すために使用されます。 データの型は、コマンドによって定義されます。

適用対象

こちらもご覧ください