Sdílet prostřednictvím


ExecutedRoutedEventArgs.Parameter Vlastnost

Definice

Získá datový parametr příkazu.

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

Hodnota vlastnosti

Data specifická pro příkazy. Výchozí hodnota je null.

Příklady

Následující příklad vytvoří pro ExecutedRoutedEventHandler vlastní RoutedCommand. Obslužná rutina aktualizuje TextBox aktuální čas a Value vlastnost Slider ovládacího prvku, který je předán obslužné rutině ExecutedRoutedEventArgs.Parameterprostřednictvím .

//  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

Poznámky

Tato vlastnost představuje obecný datový parametr, který je definován konkrétním příkazem.

Pokud tento parametr nepotřebujete, null můžete ho předat.

Obvykle se Parameter používá k předání konkrétních informací příkazu při jeho spuštění. Typ dat je definován příkazem.

Platí pro

Viz také