Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Arrow Keys not firing keyup RSS

1 reply

Last post Jul 22, 2008 04:43 PM by SteveWong

(0)
  • rbinnington

    rbinnington

    Member

    16 Points

    16 Posts

    Arrow Keys not firing keyup

    Jul 22, 2008 04:31 PM | LINK

     Hi,

    I am trying to capture the arrow keys in a UserControl I am writing.   I can capture them on the KeyUp event, but I need to capture the KeyDown.  I have read several posts and they seem to indicate that this is a bug that was wupposed to be fixed with Beta 2.  I am using Firefox and the events are still not firing.

    Is this still a bug, or am I missing something?

     
    Richard


     

    Keyboard Events KeyUp Arrow Keys

  • SteveWong

    SteveWong

    Contributor

    6719 Points

    1346 Posts

    Re: Arrow Keys not firing keyup

    Jul 22, 2008 04:43 PM | LINK

     I get it work in both IE7 and FF3

            public Page()
            {
                InitializeComponent();
                Loaded += new RoutedEventHandler(Page_Loaded);
            }

            void Page_Loaded(object sender, RoutedEventArgs e)
            {
                KeyDown += new KeyEventHandler(Page_KeyDown);
            }

            void Page_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.Key == Key.Left)
                {
                    HtmlPage.Window.Alert("Left is pressed");
                }
            }

    But the thing is first to focus on the Silverlight Control by clicking on it.

    Regards,
    SteveWong (HongKong)
    Please mark post as answer if they help you