[英]Visual Studio Add-In - adding a context menu item to solution-explorer
I'm developing my first add-in for Visual studio and we need to add a context menu item to the solution explorer, that shows up for particular file types only (in our case - ".resx"). 我正在为Visual Studio开发第一个外接程序,我们需要向解决方案资源管理器中添加一个上下文菜单项,该菜单项仅针对特定文件类型显示(在我们的示例中为“ .resx”)。
I've been googling for 2 days now, unable to find any tutorials or code-samples... Only very basic things like adding a menu-item to the VS "tools" menu etc. 我已经搜索了2天,无法找到任何教程或代码示例……只有非常基本的内容,例如在VS“工具”菜单中添加菜单项等。
Well, you need to create a dynamically visible command that you will make visible only when the selected node in the Solution Explorer is .resx file and then add the command as a child of the Solution Explorer context menu (you would need GUID:ID pair of the latter). 好吧,您需要创建一个动态可见的命令,仅当解决方案资源管理器中的选定节点为.resx文件时,该命令才可见,然后将该命令添加为解决方案资源管理器上下文菜单的子级(您需要GUID:ID对)后者)。
Here is a good article showing how to do that: http://blogs.rev-net.com/ddewinter/2008/03/22/dynamic-menu-commands-in-visual-studio-packages-part-2/ 这是一篇很好的文章,展示了如何执行此操作: http : //blogs.rev-net.com/ddewinter/2008/03/22/dynamic-menu-commands-in-visual-studio-packages-part-2/
Take a look at this video . 看一下这个视频 。 It describes how to append and control visibility of a new menu item by IDTCommandTarget interface.
它描述了如何通过IDTCommandTarget界面附加和控制新菜单项的可见性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.