问题
I'm working on a visual studio extension. It has a command that opens up a WPF window that has a single item which is a textbox. If you type in the textbox you can see the text show up, but if you hit a key combination such as ctrl+a the visual studio editor which is behind my window captures the key press and selects the content from the editor instead of my window. If I click on something like the solution explorer and go back to my window though ctrl+a will work fine. It seems that I only have the issue while the editor has focus. Any ideas what I can do to get around this?
回答1:
Open your WPF window as modal using ShowDialog or create a Visual Studio tool window to host your textbox, if you want a modeless window.
来源:https://stackoverflow.com/questions/40275337/visual-studio-editor-window-stealing-focus