简体   繁体   English

如何在Visual Studio 2015/2017的自定义工具窗口中创建窗口表单?

[英]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: 从这里开始:

Adding a tool window 添加工具窗口

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.

相关问题 如何在 Visual Studio 中寻址/调用我的自定义工具 window - How to adress/ call my custom tool window in Visual Studio 如何在 Visual Studio 中以编程方式在第一个位置显示自定义工具窗口 - How to display custom tool window at the first position, programmatically in visual studio Visual Studio 2015互动窗口 - Visual Studio 2015 Interactive Window Visual Studio 2015命令窗口 - Visual Studio 2015 Command Window 如何从 Visual Studio 扩展显示弹出 window(不是工具窗口)? - How to display popup window (not tool window) from Visual Studio extension? Visual Studio 2015属性窗口按钮不适用于Windows窗体 - Visual Studio 2015 properties window button not working for windows form 从Visual Studio 2015输出窗口中筛选自定义消息 - Filter custom message from Visual Studio 2015 output window 如何使用Visual Studio 2017注册“自定义工具”以使其工作? - How to register “custom tool” with Visual Studio 2017 to make it work? 如何在Visual Studio 2017中始终打开输出窗口 - How to keep output window always open in Visual Studio 2017 如何在Visual Studio 2015的属性窗口中更改字体大小单位? - How to change the font size unit in the properties window in Visual Studio 2015?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM