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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In WPF, you can use
Keyboard.KeyDownorKeyboard.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.