Search code examples
c#xamluwpgamepadxbox-one

Recording pressed keys from gamepad when virtual keyboard is activated


I am trying to figure out a solution how to record pressed gamepad keys on Xbox One.
I am aware of a few possible ways how to catch the keys:

  • CoreWindow.GetForCurrentThread().Dispatcher.AcceleratorKeyActivated
  • Gamepad.GetCurrentReading
  • Window.Current.CoreWindow.KeyDown

All ways work well, I get GamepadA, GamepadB etc. However, if I want to record pressed keys when <TextBox /> control has focus and "virtual keyboard" is visible on the screen, I do not receive them. I receive letters or symbols from the keyboard.

If I use Gamepad.GetCurrentReading().Buttons, then I get nothing, just GamepadButtons.None.

Is there any other way how to read pressed keys from gamepad when virtual keyboard is visible?


Solution

  • Is there any other way how to read pressed keys from gamepad when virtual keyboard is visible?

    Unfortunately, the answer is no. When the keyboard is visible, the app is focused on the keyboard witch is operated by the gamepab, we can only listen which key in the keyboard was pressed but not the gamepab, it is by design.