Skip to main content

DockManager.PopupMenuShowing Event

Occurs when a context menu is about to be displayed.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

[DXCategory("Docking")]
public event PopupMenuShowingEventHandler PopupMenuShowing

Event Data

The PopupMenuShowing event's data class is PopupMenuShowingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
Control Gets the dock control for which the DockManager.PopupMenuShowing event has been fired.
Menu Gets the popup menu that is to be displayed.
Point Gets the popup menu’s location.

Remarks

The DockManager objects support context menus for dock panels and auto-hide containers. The PopupMenuShowing event fires when an attempt is made to display such a context menu. You can handle this event to customize the menu (add new items or remove the existing ones). Menu items in the menu are represented by the DXMenuItem class objects and its descendants.

void DockManager1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
    e.Menu.Remove(DockControllerCommand.Dock);
    //add a custom item
    DXMenuCheckItem checkItem = new DXMenuCheckItem("My Item");
    e.Menu.Items.Add(checkItem);
}

To prevent the menu from being invoked, set the Allow parameter to false.

See Also