GridGroupFooterCommandContext Class
Contains contextual information for a Grid group footer context menu.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
Declaration
public class GridGroupFooterCommandContext :
GridFooterCommandContextBase,
IGridCommandContext,
ICommandContextBase
Remarks
The DevExpress Blazor Grid allows you to display context menus with predefined and custom commands. Use the ContextMenus property to activate context menus for specific Grid elements.

Handle the CustomizeContextMenu event to modify the menu item collection. Use the Context event argument to identify the target Grid element and obtain contextual information.
| Target Element | Context Type | Contextual information |
|---|---|---|
| Any | GridCommandContext | Grid |
| Data Row | GridDataRowCommandContext | Grid, Column, DataItem, RowVisibleIndex |
| Footer | GridFooterCommandContext | Grid, Column, SummaryItems |
| Group Footer | GridGroupFooterCommandContext |
Grid, Column, GroupRowVisibleIndex, SummaryItems |
| Group Panel | GridGroupPanelCommandContext | Grid |
| Group Row | GridGroupRowCommandContext | Grid, GroupColumn, RowVisibleIndex |
| Header | GridHeaderCommandContext | Grid, Column |
Example
The following example adds context commands that display/hide group summaries:

@inject WeatherForecastService ForecastService
<DxGrid Data="@forecasts"
ShowGroupPanel="true"
ContextMenus="GridContextMenus.GroupFooter"
CustomizeContextMenu="OnCustomizeContextMenu">
<Columns>
<DxGridSelectionColumn />
<DxGridDataColumn FieldName=@nameof(WeatherForecast.TemperatureC) Caption="Temp. (C)" />
<DxGridDataColumn FieldName=@nameof(WeatherForecast.TemperatureF) Caption="Temp. (F)" />
<DxGridDataColumn FieldName=@nameof(WeatherForecast.Summary) Caption="Summary" GroupIndex="0" />
<DxGridDataColumn FieldName=@nameof(WeatherForecast.Date) DisplayFormat="dd/MM/yyyy" />
</Columns>
<GroupSummary>
@foreach (var item in GroupSummaryItems) {
<DxGridSummaryItem FieldName="@item.FieldName" FooterColumnName="@item.FieldName"
SummaryType="item.Type"
ValueDisplayFormat="@item.DisplayFormat"
@key="item" />
}
</GroupSummary>
</DxGrid>
@code {
string[]? summaries;
private List<WeatherForecast>? forecasts;
IList<SummaryItem> GroupSummaryItems { get; set; }
static readonly GridSummaryItemType[] SummaryTypes = Enum.GetValues<GridSummaryItemType>()
.Where(s => s != GridSummaryItemType.None && s != GridSummaryItemType.Custom && s != GridSummaryItemType.Sum)
.ToArray();
bool IsStringColumn(string fieldName) => new[] { "Summary" }.Contains(fieldName);
record SummaryItem(string FieldName, GridSummaryItemType Type) {
public string DisplayFormat { get; init; }
}
protected override async Task OnInitializedAsync() {
forecasts = await ForecastService.GetForecastAsync();
summaries = ForecastService.Summaries;
GroupSummaryItems = new List<SummaryItem>([
new SummaryItem("TemperatureC", GridSummaryItemType.Count),
]);
}
void OnCustomizeContextMenu(GridCustomizeContextMenuEventArgs args) {
IGridColumn column = null;
IReadOnlyList<IGridSummaryItem> contextSummaryItems = null;
IList<SummaryItem> summaryItemsCollection = null;
if (args.Context is GridGroupFooterCommandContext groupFooterCommandContext) {
column = groupFooterCommandContext.Column;
contextSummaryItems = groupFooterCommandContext.SummaryItems;
summaryItemsCollection = GroupSummaryItems;
}
if (column != null && column is IGridDataColumn dataColumn) {
foreach (var summaryType in SummaryTypes) {
var fieldName = dataColumn.FieldName;
if (IsStringColumn(fieldName) && summaryType != GridSummaryItemType.Count)
continue;
var existingItem = contextSummaryItems.FirstOrDefault(i => i.FieldName == fieldName && i.SummaryType == summaryType);
var menuItem = args.Items.AddCustomItem(summaryType.ToString(), () => OnSummaryCommand(dataColumn, summaryType, summaryItemsCollection));
}
}
}
void OnSummaryCommand(IGridDataColumn dataColumn, GridSummaryItemType summaryType, IList<SummaryItem> summaryItemsCollection) {
var fieldName = dataColumn.FieldName;
var existingItem = summaryItemsCollection.FirstOrDefault(i => i.FieldName == fieldName && i.Type == summaryType);
if (existingItem != null)
summaryItemsCollection.Remove(existingItem);
else
summaryItemsCollection.Add(new SummaryItem(fieldName, summaryType) {
DisplayFormat = summaryType == GridSummaryItemType.Count ? null : dataColumn.DisplayFormat
});
StateHasChanged();
}
}
Inheritance
Object
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridCommandContextBase
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridHeaderCommandContextBase
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridFooterCommandContextBase
GridGroupFooterCommandContext
See Also