Adding/Removing menu items from context menu
A default context menu appears when you right click on Groups and items added to WinExplorerBar™. In some situations you may want to add custom menu items in addition to the default context menu or even have a context menu with just the custom menu.
Note
|
Note
When the WinExplorerBar control’s Style property is set to OutlookNavigationPane, you must handle the NavigationContextMenuIntializing event. For all other values, the contextMenuIntializing event must be handled.
|
The following code example shows you how to add/ remove the context menu by handling the ContextMenuIntializing event.
Dim customMenu As New IGMenuItem (“Custom Menu”)
'Remove the default context menu
'e.ContextMenu.Dispose ()
If e.ClickArea = ClickArea.GroupHeader Then
'Reset the ContextMenu so that any changes we made to it during prior firings of the event will be undone and the 'default' version of it will be displayed.
e.ResetMenu ()
e.ContextMenu.MenuItems.Add (customMenu)
End If
IGMenuItem customMenu= new IGMenuItem (“Custom Menu”);
// Remove the default context menu
//e.ContextMenu.Dispose ();
if (e.ClickArea == ClickArea.GroupHeader)
{
//Reset the ContextMenu so that any changes we made to it during prior firings of the ContextMenuIntializing event will be undone and the 'default' version of it will be displayed.
e.ResetMenu ();
e.ContextMenu.MenuItems.Add (customMenu);
}
The following code example shows you how to add/remove the context menu by handling the NavigationContextMenuIntializing event.
Dim outlooknavigationCustomMenu As IGMenuItem = New IGMenuItem (Outlook Navigation Custom Menu”)
'Remove the default context menu
'e.ContextMenu.Dispose ()
If e.ClickArea = NavigationPaneClickArea.GroupHeader Then
'Reset the NavigationContextMenu so that any changes we made to it during prior firings of the NavigationContextMenuInitializing event will be undone and the 'default' version of it will be displayed.
e.ResetMenu ()
e.NavigationContextMenu.MenuItems.Add (outlooknavigationCustomMenu)
End If
IGMenuItem outlooknavigationCustomMenu= new IGMenuItem (“Outlook Navigation Custom Menu”);
// Remove the default context menu
//e.ContextMenu.Dispose ();
if (e.ClickArea == NavigationPaneClickArea.GroupHeader)
{
// Reset the NavigationContextMenu so that any changes we made to it during prior firings of the NavigationContextMenuInitializing event will //be undone and the 'default' version of it will be displayed.
e.ResetMenu ();
e.NavigationContextMenu.MenuItems.Add (outlooknavigationCustomMenu);
}