Open custom user control in tool window using VS Package

耗尽温柔 提交于 2019-12-12 04:00:38

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32915831/open-custom-user-control-in-tool-window-using-vs-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!