Click or drag to resize

JamBaseShellListViewBeforeShowContextMenu Event

This event is called before the ShellContextMenu is displayed. You may use it to cancel the context menu appearing or to modify the custom menu entries in the ContextMenuStrip.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
Syntax
public event EventHandler<ListSelectionCancelEventArgs> BeforeShowContextMenu

Value

Type: SystemEventHandlerListSelectionCancelEventArgs
Remarks
When modifying the context menu, you may set the following properties of single items: Checked, Enabled, Visible.
Examples
C#
//The following example hides the first menu item from the custom context menu that is assigned to the "ContextMenuStrip" property
// of the ShellListView, if the context menu is assigned to more than one item.
// Supported properties of the items are: Checked, Visible, Enabled.
private void ShellListView1_BeforeShowContextMenu(object sender, ListSelectionCancelEventArgs e)
{
    ((ToolStripMenuItem)contextMenuStrip1.Items[0]).Visible = e.Selection.Count == 1;
}
See Also