[英]How to create window form inside custom tool window in visual studio 2015/2017?
I need to develop one extension for visual studio 2015 and 2017 where I need to provide login form which connects to some application server and upon login it will show all the services available in a treeview on visual studio . 我需要为Visual Studio 2015和2017开发一个扩展,在其中我需要提供连接到某些应用程序服务器的登录表单,登录后它将在Visual Studio的树形视图中显示所有可用的服务。 I already created it by the following way
我已经通过以下方式创建了它
custom command >>> custom form(login) >> service tree form (list all services in tree view like eclipse package explorer) 自定义命令>>>自定义表单(登录)>>服务树表单(在树视图中列出所有服务,例如eclipse包浏览器)
But problem with above approach is that it opens new window in taskbar or in another way it looks like a different window altogether . 但是上述方法的问题在于它在任务栏中打开了新窗口,或者以另一种方式看起来像是一个完全不同的窗口。 This part i don't want.
这部分我不想要。 I want this functionality in custom tool window of visual studio so that it will not appear as new window or task.
我希望在Visual Studio的自定义工具窗口中使用此功能,以便它不会显示为新窗口或任务。
Can anyone help me building the above scenario ?? 谁能帮我建立以上场景? Please note this has to support in visual studio 2015 on wards ..
请注意,此功能必须在病房的Visual Studio 2015中提供支持。
Thanks in advance. 提前致谢。
Start here: 从这里开始:
Finally found the way to dynamically add treeview and add children to custom tool window. 最终找到了动态添加treeview并将子级添加到自定义工具窗口的方法。
Here is the way : 方法是这样的:
Following code snippet has been added to constructor of customtoolwindow controller class. 以下代码段已添加到customtoolwindow控制器类的构造函数中。
TreeViewItem treeItem = new TreeViewItem();
treeItem.Header = "North America";
treeItem.Items.Add(new TreeViewItem() { Header = "USA" });
treeItem.Items.Add(new TreeViewItem() { Header = "Canada" });
treeItem.Items.Add(new TreeViewItem() { Header = "Mexico" });
TreeView treeView = new TreeView();
treeView.Items.Add(treeItem);
sampleStack.Children.Add(treeView);
where sampleStack is defined in respective .xaml file. 其中sampleStack在相应的.xaml文件中定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.