Keydown and Keypress don't fire for cursor keys.

3 posts, 0 answers
  1. Phillip
    Phillip avatar
    5 posts
    Member since:
    Apr 2018

    Posted 05 Nov 2018 Link to this post


    I'm trying to allow additional data on my chart to be panned through via the arrow keys but it appears that keydown and keypress events aren't firing for the cursor keys. Keyup DOES fire on arrow keys at least, but I'd much rather have it happen on keydown. Is there a reason for this behaviour or a workaround/setting I've not noticed?


  2. Phillip
    Phillip avatar
    5 posts
    Member since:
    Apr 2018

    Posted 05 Nov 2018 in reply to Phillip Link to this post

    So I ended up finding out the answer to this while chasing up some odd KeyUp behaviour and I figured I'd best post it here in case it comes up for anyone else.

    This is actually default WinForms behaviour, summarized in this article's remarks. Basically you need to use the PreviewKeyDown event and decide you want the key to be treated as an input key for it to trigger KeyPress and KeyDown. Not exactly sure why KeyUp is exempt from this yet but it's not a Telerik-exclusive issue in any case.

  3. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4125 posts

    Posted 06 Nov 2018 Link to this post

    Hello, Phillip, 
    I am glad that the problem you were facing is now resolved. Indeed, the PreviewKeyDown event is appropriate for handling before the KeyDown is actually triggered. The referred MSDN article explains in details how to proceed in this case. 

    I would recommend to have a look at the MSDN forum and StackOverflow for general programming questions like this. 

    Should you have further questions regarding the Telerik UI for WinForms suite please let me know.

    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top