Reputation: 8768
Is there a way, short of adding the event for every single control, to have a KeyDown event that fires regardless of the selected control?
Upvotes: 1
Views: 155
Reputation: 564413
In WPF, you can use Keyboard.KeyDown
or Keyboard.PreviewKeyDown
, and subscribe on a container, not each element. The basic bubbling and tunneling routing strategies of the Routed Event will cause it to pass to the container properly.
For details, see To bubble or tunnel basic events on CodePlex.
Upvotes: 1