TextViewCreated 的替代品,例如 (TextViewChanged)?
我正在 C# 中创建一个小型 Visual Studio 2010 扩展,它使用 IWpfTextViewCreationListener 和 TextViewCreated 来捕获在 VS 环境中打开新 TextView 的时间。我遇到的问题是,此方法仅在通过 VS 解决方案资源管理器窗口打开新窗口时触发,而在 VS 启动时已包含打开的窗口并切换窗口选项卡时不会触发。我尝试过寻找类似 TextViewChanged 的方法,但找不到这样的方法。当选择另一个选项卡式窗口时,是否有办法捕获新的 TextView ?
任何帮助将不胜感激。
这个问题也发布在 MSDN VS Extensibility 论坛上: VSX 2010 - TextViewCreated 的替代方案,例如(TextViewChanged)?
谢谢
约翰
I am creating a small Visual Studio 2010 extension in C# which uses the IWpfTextViewCreationListener and TextViewCreated to capture when a new TextView is opened in the VS environment. The problem I am having is that this method only fires when a new window is opened via the VS Solution Explorer window, and not fired when VS already contains opened windows when started, and switching window tabs. I have tried looking for something like TextViewChanged, but could not find such method. Is there anyway to capture the new TextView when another tabbed window is selected?
Any help would be greatly appreciated.
This question has also been posted on the MSDN VS Extensibility forum:
VSX 2010 - Alternative to TextViewCreated such as (TextViewChanged)?
Thanks
John
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有 TextViewCreated,但如果您在创建时注册到 IWpfTextView.GotAggregateFocus,则您将获得文件之间每个切换的挂钩:
如果您希望能够在文件之间进行链接,您可能还需要跟踪 IWpfTextView 对象。向每个文本视图的逻辑触发事件。
There is no TextViewCreated, but if you register to IWpfTextView.GotAggregateFocus as it is created, you get a hook to every switch between files:
You may also want to keep track of the IWpfTextView objects, if you want to be able to link between the fired events to your logic of each textview.