Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DockManager.PopupMenuShowing Event

Occurs when a context menu is about to be displayed.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#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