이 문서는 기계 번역을 이용하여 번역되었습니다. 문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문

CommandBinding.Executed 이벤트

 

게시 날짜: 2016년 11월

CommandBinding에 연결된 명령이 실행되면 발생합니다.

네임스페이스:   System.Windows.Input
어셈블리:  PresentationCore(PresentationCore.dll에 있음)

public event ExecutedRoutedEventHandler Executed

When a T:System.Windows.Input.RoutedCommand executes, it raises the E:System.Windows.Input.CommandBinding.PreviewExecuted event on the command target. If the E:System.Windows.Input.CommandBinding.PreviewExecuted event is not handled, the E:System.Windows.Input.CommandBinding.Executed event is raised on the command target. If the command target has a T:System.Windows.Input.CommandBinding for the specific command, the E:System.Windows.Input.CommandBinding.Executed handler for that T:System.Windows.Input.CommandBinding is called. If the command target does not have a T:System.Windows.Input.CommandBinding for that specific command the E:System.Windows.Input.CommandBinding.Executed event bubbles up the element tree searching for an element that has a T:System.Windows.Input.CommandBinding associated with the command. If a T:System.Windows.Input.CommandBinding is not found, the command is not handled.

Identifier field

ExecutedEvent

Routing strategy

Bubbling

Delegate

ExecutedRoutedEventHandler

  • The corresponding tunneling event is E:System.Windows.Input.CommandBinding.PreviewExecuted.

The following example creates a T:System.Windows.Input.CommandBinding that maps an T:System.Windows.Input.ExecutedRoutedEventHandler and a T:System.Windows.Input.CanExecuteRoutedEventArgs handler to the P:System.Windows.Input.ApplicationCommands.Open command.

<Window.CommandBindings>
  <CommandBinding Command="ApplicationCommands.Open"
                  Executed="OpenCmdExecuted"
                  CanExecute="OpenCmdCanExecute"/>
</Window.CommandBindings>
// Creating CommandBinding and attaching an Executed and CanExecute handler
CommandBinding OpenCmdBinding = new CommandBinding(
    ApplicationCommands.Open,
    OpenCmdExecuted,
    OpenCmdCanExecute);

this.CommandBindings.Add(OpenCmdBinding);

The following shows the T:System.Windows.Input.ExecutedRoutedEventHandler which creates a T:System.Windows.MessageBox when the command is executed.

void OpenCmdExecuted(object target, ExecutedRoutedEventArgs e)
{
    String command, targetobj;
    command = ((RoutedCommand)e.Command).Name;
    targetobj = ((FrameworkElement)target).Name;
    MessageBox.Show("The " + command +  " command has been invoked on target object " + targetobj);
}

.NET Framework
3.0 이후 사용 가능
맨 위로 이동
표시: