Back to Devexpress

DockManager.PopupMenuShowing Event

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockmanager.md

latest3.2 KB
Original Source

DockManager.PopupMenuShowing Event

Occurs when a context menu is about to be displayed.

Namespace : DevExpress.XtraBars.Docking

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Docking")]
public event PopupMenuShowingEventHandler PopupMenuShowing
vb
<DXCategory("Docking")>
Public Event PopupMenuShowing As PopupMenuShowingEventHandler

Event Data

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

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
ControlGets the dock control for which the DockManager.PopupMenuShowing event has been fired.
MenuGets the popup menu that is to be displayed.
PointGets 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.

csharp
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);
}
vb
Private Sub DockManager1_PopupMenuShowing(ByVal sender As Object, ByVal e As PopupMenuShowingEventArgs)
    e.Menu.Remove(DockControllerCommand.Dock)
    Dim checkItem As DXMenuCheckItem = New DXMenuCheckItem("My Item")
    e.Menu.Items.Add(checkItem)
End Sub

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

See Also

DockManager Class

DockManager Members

DevExpress.XtraBars.Docking Namespace