在 Visual Studio 扩展中,我在 .vsct 文件中将工具栏定义为:
<Menu guid="guidVsCmdSet" id="MyToolbar" type="Toolbar" >
<CommandFlag>TextChanges</CommandFlag>
<CommandFlag>DefaultDocked</CommandFlag>
<Strings>
<ButtonText>My Tools/ButtonText>
</Strings>
</Menu>
当我在 Visual Studio Experimental hive 中启动扩展时,我可以通过右键单击 CommandBar 区域来手动打开工具栏。
有什么方法可以让我第一次运行扩展时默认显示工具栏?
我尝试了其他几个 CommandFlags,但它们似乎没有执行此行为:
<CommandFlag>AlwaysCreate</CommandFlag>
<CommandFlag>DontCache</CommandFlag>
您想要查看的是可见性约束。下面的示例使用 GUID_TextEditorFactory 使其在文本编辑器处于活动状态时可见(并在设计器处于活动状态时隐藏)。
我不是 100% 确定正确的上下文是什么以使其始终可见,但我的猜测是 UICONTEXT_NoSolution (或者可能是 GUID_VSStandardCommandSet97)。
<CommandTable>
<Commands.../>
<VisibilityConstraints>
<VisibilityItem guid="guidVsCmdSet" id="MyToolbar" context="GUID_TextEditorFactory" />
</VisibilityConstraints>
</CommandTable>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)