Using your own Context Menu

The control comes with a default Context Menu which serves the most common purpose. This context menu shows menu for Image Editor if the cursor is on an image, Hyperlink Editor if the cursor is on Hyperlink, Table Editor if the cursor is on Table etc. Also this context menu offers Table Manipulation Menu items like Add New Column, Add New Row, Delete Row, Delete Column etc.


Now, if you want to override this context menu with your own one,

Step 1 : Simply add a context menu Control to your windows form from the Visual Studio Toolbox and Add the menu items to your context menu according to your preference.


Step 2: Open the Property Browser and set EditorContextMenu property to be your custom context menu.


Thats all you need to do in order to set your custom context menu. If you are thinking, how you could call the common functionalities from your context menu that are similar to Toolbox Item functions, you can find all the Toolbar button's related method from the ToolbarItemOverrider property as shown here:


How to control showing some of the menu item based on context ?

There is a event named ContextMenuShowing. Simply handle this event and from that event, you can set visible property of a particular menu item = TRUE / FALSE based on context.

The composite property StateQuery can help you to find out the current context.


Dont want to start from scratch ? Rather, do you want to enhance the default context menu ? Yes, that is possible. We have provided the source code and the full implementation of the Default Context menu in the Download Package you received from our website. Please open that zip file and navigate to Samples folder. You will find complete implementation source code of the default context menu. You can simply change that based on your need.

If you do not want to show any context menu at all, you may set the "Options.DisableEditorRightClick" = True


Last updated on Jun 28, 2012