-1

I defined a keybinding in my XAML-code:

<KeyBinding Command="{Binding CopyCommand}" Modifiers="Control" Key="C" />

If i press CTRL+C, the CopyCommand isn't called. If i use the following instead:

<KeyBinding Command="{Binding CopyCommand}" Modifiers="Control" Key="U" />

and press CTRL+U the command works fine. I think the reason for this is, that the CTRL+C gets handled somewhere else and the Handled value of the KeyEventArgs is set to true, so it doesn't reach my control.

Do I have any possibility to find all consumers for this/any given event? Can I somehow debug/follow an event from the moment it is created until it is consumed?

Simply searching for KeyDown-handlers is not really an option.

I would be fine with using even an external software, e.g. something like Snoop, but would prefer a solution using Visual Studio 2012 or writing code.

user1753343
  • 158
  • 3
  • 12

1 Answers1

0

Using Snoop I could see that CTRL+U gets handled by the UserControl (StructurePanelV) while CTRL+C is handled by the Devexpress` TreeListControl inside the StructurePanelView.

enter image description here

Because the TLC handles the PreviewKeyDown- but the KeyBinding listens on the KeyDown-event CTRL+C doesn't work (for the order of events please have a look at this article https://wpf.2000things.com/2012/08/07/619-event-sequence-for-the-key-updown-events/).

It seems there is no possibility to define a XAML-KeyBinding as a PreviewKeybinding.

The link provided by Laganimal works fine becaue it also registers on the PreviewKeyDown-event.

user1753343
  • 158
  • 3
  • 12