Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to set a shortcut for "Navigate to Event Handler" operation available on events in XAML editor. Currently, I right-click the event name (in XAML) and select "Navigate to Event Handler". However, I'd like to be able to set a shortcut.

The shortcut I want for this action is F12, but there is already a shortcut "Edit.GoToDefinition" set to F12 (Global).

I can't set it to F12 without clearing the F12 (Global) setting for Edit.GoToDefinition.

There is a combo box "Use new shortcut in:" where I can set a context in which I want to use the shortcut. However, I can't find the XAML editor on the list. I've tried and set it to "HTML Editor Source View", but it didn't work. Then I've tried to set it to "Text Editor", and then it worked, but then Edit.GoToDefinition got overriden in source code. And since the "Navigate to Event Handler" has no meaning in code-behind, nothing happens on F12.

Is there an option in "Use new shortcut in:" I can use to limit F12 : EditorContextMenus.XAMLEditor.NavigateToEventHandler to work only in XAML editor?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Well, here is your problem. The XAML editor is technically an extension of the Editor component itself. So there is no way, through the option box, for you to do what you want. Now you can punch in some code to do that, but that seems like firing a bazooka to kill an ant when a better alternative is to pick a different shortcut.

Now you CAN just write a macro and bind that to F12. Basically you can check the extension of the document you are working on. *.cs? Goto definitions. *.xaml? navigateto!

share|improve this answer

I just came across this problem, but luckily in VS2012 there is a separate context for the XAML Editor.

The command you need to use is EditorContextMenus.XAMLEditor.NavigatetoEventHandler

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.