Visual Studio 编辑器窗口窃取焦点 [英] Visual studio editor window stealing focus

查看:33
本文介绍了Visual Studio 编辑器窗口窃取焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Visual Studio 扩展.它有一个命令可以打开一个 WPF 窗口,该窗口具有一个文本框项.如果您在文本框中键入,您可以看到文本显示出来,但是如果您按下组合键,例如 ctrl+a,我窗口后面的 Visual Studio 编辑器会捕获按键操作并从编辑器而不是我的窗口中选择内容.如果我单击解决方案资源管理器之类的内容并返回到我的窗口,尽管 ctrl+a 可以正常工作.似乎我只有在编辑器有焦点时才遇到问题.有什么想法可以解决这个问题吗?

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?

推荐答案

如果需要无模式窗口,请使用 ShowDialog 以模式打开 WPF 窗口,或创建 Visual Studio 工具窗口来托管文本框.

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.

这篇关于Visual Studio 编辑器窗口窃取焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆