TextBox KeyUp and KeyDown-Events are not fired correctly.
See original GitHub issue- .NET Core Version: (Net 6.04)
- Windows version: (
Windows 10
) - Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
Problem description: TextBox KeyUp- and KeyDown events are not fired for all keys.
Actual behavior: The KeyUp- and KeyDown-Event are only fired on special keys like ‘enter’ or ‘tabulator’
Expected behavior: All Keys should fire the event.
Issue Analytics
- State:
- Created a year ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
c# - .NET: TextChanged event for TextBox not always firing, ...
fires off the TextChanged event, arrow keys, insert,overwrite do not fire but are caught by the KeyUp/KeyDown event.
Read more >Element: keydown event - Web APIs | MDN
Unlike the deprecated keypress event, the keydown event is fired for all keys, regardless of whether they produce a character value.
Read more >Keyboard: keydown and keyup
So if we want to track any input into an <input> field, then keyboard events are not enough. There's another event named input...
Read more >In Windows 10 Winforms app, Keys.Right and Key.Left are ...
In Visual Studio 2022 CE, I have a Windows 10 Winforms application, and in a TextBox.KeyPress event handler, I am trying to handle...
Read more >How to make a key fire when key is pressed using JavaScript
The 'keydown' event only allows for the respective event to fire if the key is not already held down by checking the flag...
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
@bspautz1969 Thank you, I am not sure what else to try. Would you be able to check whether WM_KEYDOWN/WM_KEYUP messages are sent to the window, or see if the same problem happens to Windows Forms applications?
If you are familiar with the Spy++ tool, you could use it to look at the keyboard messages being sent to the window (which would then be translated to the KeyUp/KeyDown events):
If you don’t get those, then something is going on on the machine rather than in WPF.