Skip to main content

BaseView.PopupMenuShowing Event

Fires when a context menu is about to be displayed.

Namespace: DevExpress.XtraBars.Docking2010.Views

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

public event PopupMenuShowingEventHandler PopupMenuShowing

Event Data

The PopupMenuShowing event's data class is DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs.

Remarks

You can handle this event to add custom menu items to a context menu or to prevent the menu from being displayed.

The event’s Menu parameter specifies the menu to be displayed. You can add custom items to this menu or remove existing items, if required. The event’s HitInfo object allows you to identify the View’s clicked element for which the menu should be displayed.

To cancel the menu display, set the event’s Cancel parameter to true.

Use the Menu.Items collection to add or remove menu items. The code below illustrates how to add a custom DXMenuItem to the context menu within a TabbedView.

private void tabbedView1_PopupMenuShowing(object sender, DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs e) {
    e.Menu.Items.Add(new DXMenuItem("My Item", customItemClick));
}

private void customItemClick(object sender, EventArgs e) {
    //do something
}

See the GridView.PopupMenuShowing event description for examples.

See Also