All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GridOptionsMenu.EnableGroupRowMenu Property

Gets or sets whether users can invoke a context menu with a right-click on a group row.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[DefaultValue(false)]
[XtraSerializableProperty]
public virtual bool EnableGroupRowMenu { get; set; }
<DefaultValue(False)>
<XtraSerializableProperty>
Public Overridable Property EnableGroupRowMenu As Boolean

Property Value

Type Default Description
Boolean

false

true, if users can invoke a context menu with a right-click on a group row; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to EnableGroupRowMenu
AdvBandedGridView
.OptionsMenu.EnableGroupRowMenu
BandedGridView
.OptionsMenu.EnableGroupRowMenu
GridView
.OptionsMenu.EnableGroupRowMenu

Remarks

If the GridView.OptionsMenu.EnableGroupRowMenu option is enabled, the grid view shows a context menu when a user right-clicks a group.

Predefined commands

The context menu contains the following predefined commands:

  • Collapse (Expand) — collapses (expands) the clicked group.
  • Full Collapse — collapses all groups.
  • Full Expand — expands all groups.

Localize the menu

The GridLocalizer allows you to localize the command captions. Use the MenuGroupRowCollapse, MenuGroupRowExpand, MenuGroupPanelFullExpand and MenuGroupPanelFullCollapse fields to identify the commands.

using DevExpress.XtraGrid.Localization;

GridLocalizer.Active = new GroupRowContextMenuLocalizer();

public class GroupRowContextMenuLocalizer : GridLocalizer {
    public override string Language { get { return "English"; } }
    public override string GetLocalizedString(GridStringId id) {
        switch (id) {
            case GridStringId.MenuGroupRowCollapse: return "Collapse this group";
            case GridStringId.MenuGroupRowExpand: return "Expand this groups";
            case GridStringId.MenuGroupPanelFullExpand: return "Expand all groups";
            case GridStringId.MenuGroupPanelFullCollapse: return "Collapse all nodes";
            default: return base.GetLocalizedString(id);
        }
    }
}

Populate the menu

You can handle the GridView.PopupMenuShowing event to populate the menu with custom items.

using DevExpress.XtraGrid.Localization;

gridView1.PopupMenuShowing += GridView1_PopupMenuShowing;

private void GridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) {
    if (e.Menu is DevExpress.XtraGrid.Menu.GridViewGroupRowMenu) {
        DevExpress.Utils.Menu.DXMenuItem item = new DevExpress.Utils.Menu.DXMenuItem();
        item.Caption = "Item";
        item.Click += (ss, ee) => { MessageBox.Show("Item clicked"); };
        e.Menu.Items.Add(item);
        e.Allow = true;
    }
}
See Also