Find Destination RoutedEvent

When I execute the redirected command, let's say:

ApplicationCommands.Undo.Execute(null, this);

WPF does some magic to find the right CommandBindingone on which it is executing ExecutedRoutedEventHandler.

Is there a way to get a link to CommandBinding(or at least a handler) that will be executed?

Sometimes it would be nice to debug information about who is processing the command.

+3
source share
1 answer

You can check CommandBinding lists in:

       UIElement
       ContentElement 
       UIElement3D

ApplicationCommands is checked internally if the sender has a specific command in the CommandBinding. In addition, if the sender is null, then Keyboard.FocusedElement is assigned by the sender.

0

Source: https://habr.com/ru/post/1771073/


All Articles