ExecutedRoutedEventArgs.Command 속성
정의
호출된 명령을 가져옵니다.Gets the command that was invoked.
public:
property System::Windows::Input::ICommand ^ Command { System::Windows::Input::ICommand ^ get(); };
public System.Windows.Input.ICommand Command { get; }
member this.Command : System.Windows.Input.ICommand
Public ReadOnly Property Command As ICommand
속성 값
이 이벤트와 연결된 명령입니다.The command associated with this event.
예제
다음 예제에서는 ExecutedRoutedEventHandler 여러 명령을 처리 하는을 만듭니다.The following example creates an ExecutedRoutedEventHandler that handles multiple commands. 처리기는 Command 의 속성을 확인 ExecutedRoutedEventArgs 하 여 호출할 메서드를 결정 합니다.The handler checks the Command property on the ExecutedRoutedEventArgs to determine which method to call.
private void ExecutedDisplayCommand(object sender,
ExecutedRoutedEventArgs e)
{
RoutedCommand command = e.Command as RoutedCommand;
if(command != null)
{
if(command == MediaCommands.Pause)
{
MyPauseMethod();
}
if(command == MediaCommands.Play)
{
MyPlayMethod();
}
if(command == MediaCommands.Stop)
{
MyStopMethod();
}
}
}
Private Sub ExecutedDisplayCommand(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
Dim command As RoutedCommand = TryCast(e.Command, RoutedCommand)
If command IsNot Nothing Then
If command Is MediaCommands.Pause Then
MyPauseMethod()
End If
If command Is MediaCommands.Play Then
MyPlayMethod()
End If
If command Is MediaCommands.Stop Then
MyStopMethod()
End If
End If
End Sub
설명
형식이 알려진 경우 이벤트와 연결 된 명령을와 같은의 특정 구현으로 캐스팅할 수 있습니다 ICommand RoutedCommand .The command associated with the event can be cast to the specific implementation of ICommand, such as a RoutedCommand, if the type is known.