ExecutedRoutedEventArgs.Parameter 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得指令的資料參數。
public:
property System::Object ^ Parameter { System::Object ^ get(); };
public object Parameter { get; }
member this.Parameter : obj
Public ReadOnly Property Parameter As Object
屬性值
指令專用的資料。 預設值為 null。
範例
以下範例為自訂 RoutedCommand。ExecutedRoutedEventHandler 處理器會更新 a TextBox 的當前時間,以及ValueSlider透過 ExecutedRoutedEventArgs.Parameter.
// 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 傳遞特定資訊給指令。 資料的類型由指令定義。