Gather keyboard input
See original GitHub issueIn UWP, this would be how I get keyboard input for a Xaml application …
Microsoft.UI.Xaml.Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
This doesn’t work for WinUI, with output… Microsoft.UI.Xaml.Window.Current.get returned null. How do we get keyboard input for the Window?
I should mention that gathering from a control, such as SwapChainPanel also doesn’t work. It’s a pretty weird design for sure.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:17 (5 by maintainers)
Top Results From Across the Web
Keyboard Shortcuts
You can view the full list of shortcuts below or by going to Menu > Settings > User > Keyboard Shortcuts while in...
Read more >How to Gather User Input via Keypad (DTMF Tones)
In this guide, we'll show you how to gather user input during a phone call through the phone's keypad (using DTMF tones) in...
Read more >Gather Town Android Phone Virtual Keyboard - YouTube
Remarks: After install, please enable keyboard, select u input languages, set u input method to Hacker's Keyboard.
Read more >Get User Input from Keyboard - input() function - Python
The input() function gets user input (keyboard) and stores it into variable name. Here name is a variable. The print() function shows it...
Read more >5 Unique Hotkeys in Gather Town You Need to Know
You can Press 1 to 6 on your keyboard to give emoticon. Its quite mini feature, but it work well to give a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My app isn’t UWP, but I’m using as much UWP code as possible, because really, all I want is UWP (with .Net 5 + NoOverlays + Steam support) which is only available via the desktop app model. If .Net 5 gets UWP and UWP get’s Overlay suspension and .Net 5 compilation to get away from .Net native then I will likely go back to UWP. But we are stuck on what’s being called Desktop - even though UWP is desktop as well.
From my perspective, Microsoft have introduced a new window model - the HWND - it’s something that was used historically, many years ago, before my time, and they’ve brought it back, because nostalgia. It’s weird because I’ve been using CoreWindow and I thought with .Net 5 we were getting a new unified App/Window model and framework. Instead, I have to dig into god knows where to get keyboard input, and I need to write redundant code to support this legacy thing.
“CoreWindow has sandbox restrictions” - What sandbox restrictions are you referring to that are related to how we get input? How does providing CoreWindow functionality to desktop apps break … well anything?
And none of this helps with creating a sensible, consistent and modern way to get keyboard input from the Window or SwapChainPanel. I mean, I’m sorry, but wrapping an SCP in a Grid, when it’s already a Grid just to get keyboard input because the Window doesn’t give me keyboard input is just plain goofy. Unless there is something I’m missing?
Well for the foreseeable, CoreWindow is off limits. That is why it returns NULL
You will have to do it the Win32 way until more fundamental changes come, probably through Reunion APIs