TextBox KeyDown event handling
See original GitHub issueThe TextBox control currently only handles certain KeyDown events (like Ctrl+C/V for copy/paste) and lets the rest bubble to its parents (it’s using TextInput events to handle actual text input). I was wondering how much sense it would make to unconditionally handle all key down events so that parent controls don’t get notified about these key events. AFAICT this used to be the behavior until #1357 refactored it. In my application the current behavior causes some issues with modifier-less hotkeys: Pressing space (for instance) on a TextBox will signal the parent control that is executing the hotkey.
PS: I know this question got asked internally, I am just repeating it here for visibility and community feedback.
CC: @grokys, @Gillibald
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Keyboard.KeyDown Attached Event (System.Windows.Input)
The following example creates TextBox that attaches an event handler for the KeyDown event. When the Return is pressed, the event handler displays...
Read more >Element: keydown event - Web APIs | MDN
The keydown event is fired when a key is pressed. Unlike the deprecated keypress event, the keydown event is fired for all keys, ......
Read more >Handling Textbox Keydown Events - I.T Delinquent
Here, I will you how to recognise a keydown event on a textbox and also how to “identify” which key was pressed.
Read more >onkeydown Event
The onkeydown event occurs when the user presses a key on the keyboard. Keyboard Events. Event, Occurs When. onkeydown, The user presses a...
Read more >Catch and process KeyPress/KeyDown without modifying ...
Whenever I hit Ctrl+Enter, the event does get handled, but it also registers as an Enter keypress when the focus is in either...
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 Free
Top 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

Thanks for opening this @pr8x
I’ve just tested on WPF, and WPF indeed seems to have the same behavior as Avalonia:
Typing:
testCtrl+CCtrl+VCtrl+ZCtrl+Houtputs:So it seems that we’re not doing anything particularly unexpected here. I’m not sure how this problem is handled in WPF applications, or if we need any extra functionality here?
Need to look into this, but perhaps our key binding stuff needs to be handling the tunneling events and marking them as handled?