![](/img/trans.png)
[英]How to display custom tool window at the first position, programmatically in visual studio
[英]How to adress/ call my custom tool window in Visual Studio
但是我找不到任何方法来填充它,因为我找不到引用它的方法。
我检查了您在上面共享的 totorial 链接并找到了这个文档: Writing A Custom Debugger Visualizer using WPF for the UI 。 So it seems that we can combine the Debugger Visualizer with WPF, and since the custom Tool window Item has similar functions like WPF UI, I think we can fill the logic into that xx.xaml and xx.xaml.cs files, see:
基本上,我们可以用我们可能在Debugger Vusualizer+WPF
中使用的逻辑来填充这两个文件。 要调用一个自定义工具窗口,我们可以单击相关命令(按钮)或使用代码打开自定义工具 window。 类似于这个问题的东西:
ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true);
if ((null == window) || (null == window.Frame))
{
throw new NotSupportedException(Resources.CanNotCreateWindow);
}
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
我不确定您为什么需要以编程方式调用自定义 window,根据教程,我想您只需要View=>Windows
中的一个按钮 ...希望它有所帮助,如果我有什么误解,请随时纠正我:)
我试图想象我挣扎的地方。
编辑:取得了进展:
当一个在 vsix 扩展 package 内部时,可以通过查询 dte object
using EnvDTE;
using EnvDTE80;
using System.ComponentModel.Composition;
DTE2 dte = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
有了这个,可以访问保存各种信息的调试器,例如在这种情况下它保存当前活动的字段等等。
因此,这是将数据从运行时传输到 ToolWindow 的方法。 问题是如何将 DebugVisualizer 带入等式,因为它不是 package 的一部分,因此无法调用 dte。 但我很在意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.