Custom WPF Window ignoring specific keystrokes

1 day ago 3
ARTICLE AD BOX

I’m working on a Visual Studio Extension that creates a popup WPF Window, the window does have a TextBox in which can be input text.

The problem I’m facing is: Whenever I have the TextBox focused and send Backspace/Ctrl + A or Esc to it, the keystrokes goes to whatever document window I had active before instead of the TextBox.

In the gif: I have the TextBox focused it recognize normal keystrokes like a-z, but when i send Ctrl+A to it, it goes to the document window in the background, same thing for Backspace, it erases things in the document instead of the TextBox which is active.

I have created a minimal reproducible example, the code can be found here: https://github.com/jinjiere/VSExtension

A similar issue related to these keystrokes: https://developercommunity.visualstudio.com/t/Issue-where-backspace-ctrlz-and-other/11023655?ref=native&refTime=1769989905247&refUserId=67e5f4a0-c9fb-6b2b-9ad6-7f2145a23b45

I'm not sure if its a VS bug, I have also report it here: https://developercommunity.visualstudio.com/t/Custom-WPF-Window-ignore-specific-keystr/11037258

Read Entire Article