且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 VS Package 在工具窗口中打开自定义用户控件

更新时间:2023-10-13 23:10:40

vsix 开发一开始没有什么是简单的.尝试使用此教程.它来自一个系列,您可以在此处找到.

要显示自定义工具窗口内容,您必须扩展 ToolWindowPane 类并覆盖 Window 属性,将您的内容作为 IWin32Window 返回.该教程充分解释了它,我可能会补充说得很好,尽管该系列针对的是 vs2010,但它仍然非常出色.

I'm trying to create simple custom command (added in TOOLS menu option) to open the tool bar with custom control in VS 2013 using VS Package project.

I'm following https://msdn.microsoft.com/en-us/library/bb165987.aspx this guide but not sure why it's not working.

When I click on it, it opens tool window but without content under it. I want to show the MyControl.cs or custom control content under it.

I've tried a lot to find it out on Google but no relevent article found for same.

I've notice when I created new VS Package, it created "MyControl.xaml" file which loading it's data properly. I deleted that file and created new user control "MyControl.cs" which is not loading data.

Not sure if it requires VSIX project or VS Package. Is there any other way to do this?

Nothing in vsix development is simple at first. Try using this tutorial. It's from a series you can find here.

For you to show custom tool window content you have to extend the ToolWindowPane class and override the Window property returning your content as a IWin32Window. The tutorial fully explains it, and very well I might add, and the series is excellent even though it targets vs2010.