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

示例

以下示例为自定义 RoutedCommand创建 ExecutedRoutedEventHandler 。 处理程序使用通过 传递给处理程序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 用于在执行命令时将特定信息传递给命令。 数据类型由 命令定义。

适用于

另请参阅