Search code examples
wpfsilverlightuser-controlsonkeyuponkeydown

WPF OnKeyUp in UserControl not firing


I have Window with UserControl. I subscribed for OnKeyUp event but it does not firing. Inside UserControl constructor i use method this.Focus(); But still onkeyup does not firing. What is wrong and what i can to do to catch this event?


Solution

  • This is the silverlight scenario , I cannot say it will work in wpf!

    keyUp event gets fired of the usercontrol and it works great , here is the code snippet how to register the event handler for KeyUp of usercontrol :

     this.KeyUp += new KeyEventHandler(MainPage_KeyUp);
    
    
            void MainPage_KeyUp(object sender, KeyEventArgs e)
            {
    
            }