Back to Devexpress

BasePopupMenuShowingEventArgs.ShowCustomMenu(IDXDropDownControlEx) Method

windowsforms-devexpress-dot-utils-dot-menu-dot-basepopupmenushowingeventargs-dot-showcustommenu-x28-devexpress-dot-utils-dot-menu-dot-idxdropdowncontrolex-x29.md

latest3.7 KB
Original Source

BasePopupMenuShowingEventArgs.ShowCustomMenu(IDXDropDownControlEx) Method

Invokes a custom context menu instead of the control’s menu.

Namespace : DevExpress.Utils.Menu

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public void ShowCustomMenu(
    IDXDropDownControlEx popupMenu
)
vb
Public Sub ShowCustomMenu(
    popupMenu As IDXDropDownControlEx
)

Parameters

NameTypeDescription
popupMenuDevExpress.Utils.Menu.IDXDropDownControlEx

A custom context menu.

|

Remarks

To use the ShowCustomMenu method, you must:

  1. Create a custom context menu (PopupMenu) as demonstrated in the following help topic: Popup Menus.
  2. Pass this menu to the ShowCustomMenu method as a parameter.

The code sample below uses the ShowCustomMenu method to invoke a custom context menu when a user right-clicks a grid row:

csharp
void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
    if (e.MenuType == GridMenuType.Row)
        e.ShowCustomMenu(popupMenu1);
}
vb
Private Sub gridView1_PopupMenuShowing(ByVal sender As Object, ByVal e As PopupMenuShowingEventArgs)
    If e.MenuType = GridMenuType.Row Then e.ShowCustomMenu(popupMenu1)
End Sub

Common concepts for custom context menus are listed in the following help topic: Custom Context Menus.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowCustomMenu(IDXDropDownControlEx) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-show-context-menu-for-rows/CS/FormGridMenu.cs#L18

csharp
popupMenu_Row.Tag = e.HitInfo;
    e.ShowCustomMenu(popupMenu_Row);
}

winforms-grid-show-context-menu-for-rows/VB/FormGridMenu.vb#L19

vb
popupMenu_Row.Tag = e.HitInfo
    e.ShowCustomMenu(popupMenu_Row)
End If

See Also

BasePopupMenuShowingEventArgs Class

BasePopupMenuShowingEventArgs Members

DevExpress.Utils.Menu Namespace