使用 VS Package 在工具窗口中打开自定义用户控件 [英] Open custom user control in tool window using VS Package

查看:29
本文介绍了使用 VS Package 在工具窗口中打开自定义用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建简单的自定义命令(在 TOOLS 菜单选项中添加),以使用 VS Package 项目在 VS 2013 中打开带有自定义控件的工具栏.

我正在关注

我在谷歌上尝试了很多,但没有找到相关的文章.

我注意到当我创建新的 VS 包时,它创建了MyControl.xaml"文件,该文件正确加载了它的数据.我删除了该文件并创建了未加载数据的新用户控件MyControl.cs".

不确定它是否需要 VSIX 项目或 VS 包.有没有其他方法可以做到这一点?

解决方案

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.

这篇关于使用 VS Package 在工具窗口中打开自定义用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆