VSIX KeyBindings没有分配

时间:2015-09-06 09:13:14

标签: vsix

我需要启用CTRL + F12和CTRL + G

此代码不起作用

<KeyBindings>
 <KeyBinding guid="guidCmdSet" id="cmdSolutionList" editor="guidVSStd97" key1="VK_F12" mod1="CONTROL" />
 <KeyBinding guid="guidCmdSet" id="cmdCodeItemsList" editor="guidVSStd97" key1="G" mod1="CONTROL" />
</KeyBindings>

但是这段代码工作

<KeyBindings>
 <KeyBinding guid="guidCmdSet" id="cmdCodeItemsList" editor="guidVSStd97" key1="0" mod1="CONTROL" />
</KeyBindings>

为什么不工作?

如何指定CTRL + F12和CTRL + G?

1 个答案:

答案 0 :(得分:1)

使用代码

设置绑定
Command command = SolutionList.DTE.Commands.Item("Name1", -1);
command.Bindings = "Global::Ctrl+F12";
command = SolutionList.DTE.Commands.Item("Name2", -1);
command.Bindings = "Global::Ctrl+G";