Geeks With Blogs
Mark Ritchie

While the commands.vsct is an improvement over 2005's ctc files, it still leaves a lot to be desired; how about a simple designer or editor for it guys!!!!

My most recent struggle has been trying to get a sub-menu to appear, a very common thing to want to do so why is there a dearth of information on the topic?

Thanks to a some help from Wesley Yao on Visual Studio Extensibility Forum I found

the solution.

Here are the key elements from my Commands.vsct file to get the sub-menu working:

<Menu guid="guidConvertCommandsCmdSet" id="ConvertSubMenu" priority="0x100" type="Menu">

    <Parent guid="guidCmdSet" id="grpidContextMain" />

    <CommandFlag>AlwaysCreate</CommandFlag>

    <Strings>

        <CommandName>Convert To</CommandName>

        <ButtonText>Convert To</ButtonText>

    </Strings>

</Menu>

....

<!-- Buttons for sub-menu Convert Items -->

<Button guid="guidConvertCommandsCmdSet" id="ConvertToSimplePropertyCommand" priority="0x0201" type="Button">

    <Parent guid="guidConvertCommandsCmdSet" id="ConvertToSubMenuGroup" />

    <Strings>

        <ButtonText>Simple</ButtonText>

        <ToolTipText>Convert to a simple property.</ToolTipText>

    </Strings>

</Button>

....

<!-- Logical group for holding the submenus of the top level menu -->

<Group guid="guidConvertCommandsCmdSet" id="TopLevelMenuGroup" priority="0x0000">

    <Parent guid="guidCmdSet" id="grpidContextMain"/>

</Group>

<!-- Logical group for holding items in the "Convert To" submenus -->

<Group guid="guidConvertCommandsCmdSet" id="ConvertToSubMenuGroup" priority="0x0000">

    <Parent guid="guidConvertCommandsCmdSet" id="ConvertSubMenu"/>

</Group>

....

<GuidSymbol name="guidConvertCommandsCmdSet" value="{Put you own GUID here}" >

    <!--Menu-->

    <IDSymbol name="ConvertSubMenu" value="0x1100"/>

    <!--Groups-->

    <IDSymbol name="TopLevelMenuGroup" value="0x1150"/>

    <IDSymbol name="ConvertToSubMenuGroup" value="0x1151"/>

    <!--Commands-->

    <IDSymbol name="ConvertToSimplePropertyCommand" value="0x701"/>

</GuidSymbol>

Posted on Thursday, February 25, 2010 3:28 AM | Back to top


Comments on this post: Creating a SubMenu for a VisualStudio 2008's DSL designer ContextMenu

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © markritchie | Powered by: GeeksWithBlogs.net