question

JohnMartel-4927 avatar image
0 Votes"
JohnMartel-4927 asked AryaDing-MSFT commented

How to simulate holding the SHIFT key down in UWP?

Hi,

I am developing a UWP solution for a Surface Pro device in tablet without a physical keyboard. I would like to add a "SHIFT" button to the app, where if the button is held down, it would be like holding the SHIFT key down on a keyboard. I am thinking I should have an asynchronous event handler for Holding event but not sure how to proceed beyond that.

Thanks!

windows-uwp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JohnMartel-4927 You could use Injection to do this, which provides support for programmatically generating and automating input from a variety of devices such as keyboard, mouse, touch, pen, and gamepad.
InjectedInputKeyboardInfo Class will the the base for keyboard input injection. You could use its property VirtualKey to specifiy which key is the input related to, such as VirtualKey.Shift. In addition, the APIs in this namespace require the inputInjectionBrokered restricted capability. Please refer to the reply of this question to get more information.


1 Vote 1 ·

0 Answers