Search code examples
vsix

VSIX KeyBindings not assign


I need issgin CTRL+F12 and CTRL+G

This code not work

<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>

But this code work

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

Why not work?

How assign CTRL+F12 and CTRL+G?


Solution

  • Set binding with code

    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";