Бөлісу құралы:


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.

Примеры

В следующем примере создается настраиваемый ExecutedRoutedEventHandlerRoutedCommandобъект. Обработчик обновляется TextBox с текущим временем и Value свойством Slider элемента управления, передаваемого обработчику через 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 он используется для передачи определенной информации команде при выполнении. Тип данных определяется командой.

Применяется к

См. также раздел