question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created a year ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
miloushcommented, Sep 11, 2022

@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?

1reaction
miloushcommented, Sep 8, 2022

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):

image

If you don’t get those, then something is going on on the machine rather than in WPF.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found