共用方式為


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

範例

下列範例會 ExecutedRoutedEventHandler 建立自訂 RoutedCommand的 。 處理程式會使用目前的時間和Value透過 傳遞至處理程式ExecutedRoutedEventArgs.ParameterSlider 控制項屬性來更新 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 會在執行命令時,用來將特定資訊傳遞至 命令。 數據類型是由 命令所定義。

適用於

另請參閱