Open custom user control in tool window using VS P

2019-09-12 04:35发布

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.

enter image description here

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?

1条回答
何必那么认真
2楼-- · 2019-09-12 05:28

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.

查看更多
登录 后发表回答