Skip to main content

PopupMenuShowingEventArgs Class

Contains data for the GridView.PopupMenuShowing event.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

public class PopupMenuShowingEventArgs :
    BasePopupMenuShowingEventArgs

Example

The following code sample invokes a custom context menu when a user right-clicks a column header:

Create Custom Context Menus

  1. Add a BarManager to the form and create a custom PopupMenu.

  2. Handle the GridView.PopupMenuShowing event and call the e.ShowCustomMenu method to display your custom menu instead of the default header menu.

void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
    if (e.MenuType == GridMenuType.Column) {
        popupMenu_Column.Tag = e.HitInfo;
        popupMenu_Column.MenuCaption = $"{e.HitInfo.Column}";

        e.ShowCustomMenu(popupMenu_Column);
    }
}

GridHitInfo GetHitInfo(BarItemLink link) {
    PopupMenu menu = link.LinkedObject as PopupMenu;
    return menu.Tag as GridHitInfo;
}
void barButtonItem_Filter_ItemClick(object sender, ItemClickEventArgs e) {
    GridHitInfo info = GetHitInfo(e.Link);
    info.View.ShowFilterEditor(info.Column);
}

void barButtonItem_ColumnChooser_ItemClick(object sender, ItemClickEventArgs e) {
    GridHitInfo info = GetHitInfo(e.Link);
    info.View.ShowCustomization();
}
See Also