KeyDown Event is not responding till any user control is clicked or setFocus implicitly ?

Posted by Subhen on Stack Overflow See other posts from Stack Overflow or by Subhen
Published on 2010-03-29T14:10:00Z Indexed on 2010/03/29 14:13 UTC
Read the original article Hit count: 282

Filed under:
|

KeyDown Event is not responding till any user control is clicked or setFocus implicitly . I want to fire the key event after the page loads , anytime.

I tried like :

   private void Page_KeyDown(object sender, KeyEventArgs e)
             {
                 if (e.Key.ToString() == "Escape")
                   {
                        string uri = "/Views/Music/ArtistbyAlbum";
                        this.NavigationService.Navigate(new Uri(uri, UriKind.Relative));
                   }
            }

        void LayoutRoot_KeyDown(object sender, KeyEventArgs e)
                {
                    MessageBox.Show("hi");


}

Please help.

Thanks, Subhen

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about c#