We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I add cascading menu items to the context menu in Essential Edit ?

 

The context menu in Essential Edit can be populated with cascading menu items by handling the MenuFill event and adding the menu items to the IContextMenuProvider object associated with the EditControl as shown in code below.

C#

private void editControl1_MenuFill(object sender, System.EventArgs e)

{

ContextMenuManager cmm = sender as ContextMenuManager;

// Add a menu item to the context menu

cmm.AddMenuItem("Bookmarks",new EventHandler(ToggleBookmark));

// Add child menu items to the earlier menu item

IContextMenuProvider contextMenuProvider = this.editControl1.ContextMenuManager.ContextMenuProvider as IContextMenuProvider;

contextMenuProvider.AddContextMenuItem("Bookmarks","Toggle Bookmarks",new EventHandler(ToggleBookmark));

contextMenuProvider.AddContextMenuItem("Bookmarks","Clear Bookmarks",new EventHandler(ClearBookmarks));

// Add a second level of child menu items to the earlier child menu item

contextMenuProvider.AddContextMenuItem("Clear Bookmarks", "ClearAll", new EventHandler(ClearAllBookmarks));

contextMenuProvider.AddContextMenuItem("Clear Bookmarks", "Clear", new EventHandler(ClearBookmark));

}

VB

Private Sub editControl1_MenuFill(sender As Object, e As System.EventArgs) Handles editControl1.MenuFill

Dim cmm As ContextMenuManager = sender

' Add a menu item to the context menu

cmm.AddMenuItem("Bookmarks", New EventHandler(AddressOf ToggleBookmark))

' Add child menu items to the earlier menu item

Dim contextMenuProvider As IContextMenuProvider = Me.editControl1.ContextMenuManager.ContextMenuProvider

contextMenuProvider.AddContextMenuItem("Bookmarks", "Toggle Bookmarks", New EventHandler(AddressOf ToggleBookmark))

contextMenuProvider.AddContextMenuItem("Bookmarks", "Clear Bookmarks", New EventHandler(AddressOf ClearBookmarks))

' Add a second level of child menu items to the earlier child menu item

contextMenuProvider.AddContextMenuItem("Clear Bookmarks", "ClearAll", New EventHandler(AddressOf ClearAllBookmarks))

contextMenuProvider.AddContextMenuItem("Clear Bookmarks", "Clear", New EventHandler(AddressOf ClearBookmark))

End Sub 'editControl1_MenuFill

Please refer to the test sample attached below that illustrates this.

Article ID: Published Date: Last Revised Date: Platform: Control:
361 04/30/2011 07/10/2014 WinForms EditControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon