views:

449

answers:

2

Hi when I do in one of my user controls in a WPF application, this.KeyUp += new System.Windows.Input.KeyEventHandler(MultipleControlViewer_KeyUp); or this.KeyDown += new System.Windows.Input.KeyEventHandler(MultipleControlViewer_KeyUp); or this.AddHandler(Window.KeyDownEvent, new System.Windows.Input.KeyEventHandler(MultipleControlViewer_KeyUp), true); I can never get the key events to fire when pusing a key on the keyboard. Would anyone know why? Thanks

A: 

the event is probably being handled before you can get to it, if any handlers mark the KeyEventArgs e.Handled = true; you wont get the notification, try using the PreviewKeyDown or PreviewKeyUp events and see if you have more luck.

Aran Mulholland