Click or drag to resize

ShellListViewBackgroundContextMenu Property

Gets or sets the ContextMenuStrip that is displayed if no item of the listview is under the cursor if the user clicks the right mouse button. If this value is null, no ContextMenu is shown.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
Syntax
public override ContextMenuStrip BackgroundContextMenu { get; set; }

Property Value

Type: ContextMenuStrip
Remarks
By default the ShellListView uses a context menu similar to the one known by Windows Explorer. To customize subclass BackgroundContextMenu and override SetupMenuItems and assign it to this property.
Examples
The following example uses BackgroundContextMenu as base class for a custom background context menu and assigns it in the Load event of a form.
class MyBackgroundContextMenu : BackgroundContextMenu
{
    protected override void SetupMenuItems()
    {
         base.SetupMenuItems();
        ToolStripMenuItem myItem = new ToolStripMenuItem("My Additional Item");
        myItem.Click += myItem_Click;
        Items.Add(myItem);
        //hide a default item:
        //this.Actualize.Visible = false;
    }

    void myItem_Click(object sender, EventArgs e)
    {
        MessageBox.Show("additional item clicked");
    }
}
//Eventhandler for the Load event of a form:
private void JamExplorerMain_Load(object sender, EventArgs e)
{
    shellListView1.BackgroundContextMenu = new MyBackgroundContextMenu();
}
See Also