I looking for solution (using ArcObject SDK 10.1 (VB.NET) ArcMap Addin template) to substitute the default shortcut "right-click" menu in the TOC (When a TOC Item is right-clicked) with a custom menu when a custom tool is active. (I would like default functionality when a custom tool is inactive)

I already do that in the map - I have a custom tool and when the tool I show a custom menu on right-click. The custom behavior only works within the map frame.

How can I do the same in the TOC?

enter image description here

  • The question in your post "how can i gather information about the TOC item that was right-clicked or left-clicked in the TOC" doesn't really match the question in the title. Anyway, did you try IMxDocument.SelectedItem? Commented Mar 1, 2013 at 15:55
  • Thanks @KirkKuykendall. Edited the post. I want to focus on substituting the shortcut menu when a layer in the TOC is right-clicked. Commented Mar 1, 2013 at 16:43

1 Answer 1


As far as I can tell there is no event exposed in ArcObjects for when a context menu is opened in the TOC, and no entry point to override it.

You would likely have to delve into the Windows API, listen for specific messages and respond to whichever one corresponds to the default context menu display and replace it with your own. This can get really ugly so hopefully there is a better way.

There is some good info in these questions:

It may be possible to use ICustomizationFilter to listen for and block the context menu event but I have not tried it. This blog post shows how something similar can be done within a VB.NET add-in. I am not sure how you would replace the context menu with your own though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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