how to disable keyboard from gridview RRS feed

  • Question

  • Hello, I am developping a game for tablet and PC, I have a gridview, that contains as first item the game board (a grid), second item is game history and third item is highscore.
    the problem is I use keydown event on my game board to control the game with keyboard. everything fine but the 2 keys VirtualKey.Left and VirtualKey.Right does not work as it is handled by the gridview for scrolling.

    is there's a way to disable keyboard event for a gridview (keep the scrolling with mouse/scrollbar or touch but disable the scrolling with right and left button of the keyboard) to use it in the gameboard and keeping the benefit of gridview scrolling?

    thanks in advance!

    Wednesday, December 18, 2013 4:52 PM


All replies

  • Breaking keyboard access for the GridView is a really bad idea. The app should be fully usable with keyboard only. The GridView will only handle key events when it has the focus, so if you set the focus to your gameboard during play they shouldn't interfere with each other.
    Wednesday, December 18, 2013 6:10 PM
  • Hi Rob,
    thanks for you answer, but I didn't find any way to programatically set the focus on my grid, the control does not have any Focus() function.

    Wednesday, December 18, 2013 9:24 PM
  • Focus needs to go to a tabstop enabled Control, not a panel, but you can put one in your Grid to drive the keyboard input in that area.

    See Implementing keyboard accessibility for more details on keyboard interaction.


    Wednesday, December 18, 2013 10:07 PM