Skip to main content

GridView.GridMenuItemClick Event

Enables you to provide custom responses to clicking context menu items.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public event GridMenuItemClickEventHandler GridMenuItemClick

Event Data

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

Property Description
AutoFilterCondition Gets the currently processed filter condition (when the GridMenuItemClick event fires for items in the auto-filter row‘s menu).
Column Gets the column whose footer cell or header was clicked to invoke a context menu.
DXMenuItem Gets the clicked menu item.
Handled Gets or sets a value specifying whether default menu item click processing is required after event handler execution.
MenuItem Obsolete. This property is obsolete.
MenuType Gets the type of the context menu whose item was clicked.
SummaryFormat Gets or sets the summary value formatting.
SummaryItem Gets a summary item object corresponding to the footer cell whose menu’s item was clicked.
SummaryItems Gets the View’s group summary items collection.
SummaryType Gets the summary type which is about to be applied.


The GridMenuItemClick event is fired in response to clicking a menu item. It enables you to cancel default actions performed when clicking a particular item and provide your own item handling. You can also perform actions as well as the default processing. For instance, you may update a summary item’s formatting when end-users change the summary type using context menus.

Note: the GridMenuItemClick event is not raised when clicking menu items that are created manually in your GridView.PopupMenuShowing event handler.


The following code demonstrates how to use the GridView.GridMenuItemClick event to customize a specific column’s summary. The code determines for which column a menu is activated, and if this column’s GridColumn.FieldName property value is “UnitPrice” and the menu type is a footer menu and an item clicked is not “Count”, then the text displayed in the summary footer under the “UnitPrice” column is formatted to display the summary value in currency format:

GridMenuItemClick result

using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Localization;

private void gridView_GridMenuItemClick(object sender, GridMenuItemClickEventArgs e) {
    string  sumFormat; 
    int subSumFormat;
    //Summary format is only adjusted for the UnitPrice column, 
    // if its summary type is not Count
    if(e.MenuType != GridMenuType.Summary || e.DXMenuItem.Tag.Equals(
      GridStringId.MenuFooterCount)) return;
    if(e.Column.FieldName == "UnitPrice") {
        sumFormat = e.SummaryFormat;
        //Find the summary value placeholder
        subSumFormat = sumFormat.IndexOf("0");
        //Custom format string
        if(subSumFormat > 0) sumFormat = sumFormat.Substring(0, subSumFormat) + "0:c}";
        //Update the summary format string
        e.SummaryFormat = sumFormat;
See Also