Domanda

In a Visual Studio extension, I have defined a Toolbar in my .vsct file as:

      <Menu guid="guidVsCmdSet" id="MyToolbar" type="Toolbar" >
        <CommandFlag>TextChanges</CommandFlag>
        <CommandFlag>DefaultDocked</CommandFlag>      
        <Strings>
          <ButtonText>My Tools/ButtonText>
        </Strings>
      </Menu>

When I launch my extension in Visual Studio Experimental hive, I can open my Toolbar manually via right clicking in the CommandBar area.

Is there any way to have the toolbar show up by default when I first run the extension?

I have tried a couple other CommandFlags, but they did not seem to perform this behavior:

    <CommandFlag>AlwaysCreate</CommandFlag>
    <CommandFlag>DontCache</CommandFlag>   
È stato utile?

Soluzione

Read about how to do that in this workaround: LVN! Sidebar #7 - Showing a toolbar at Visual Studio startup

Altri suggerimenti

What you want to look at is Visibility Constraints. The below example uses GUID_TextEditorFactory which makes it visible when a text editor is active (and hide when, for example a designer is active).

I'm not 100% sure what the correct context is to make it always visible, but my guess is UICONTEXT_NoSolution (or maybe GUID_VSStandardCommandSet97).

<CommandTable>
    <Commands.../>
    <VisibilityConstraints>
        <VisibilityItem guid="guidVsCmdSet" id="MyToolbar" context="GUID_TextEditorFactory" />
    </VisibilityConstraints>
</CommandTable>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top