GridCommandContext Class
Contains contextual information for a Grid context menu.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
Declaration
public class GridCommandContext :
GridCommandContextBase,
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 custom Show Footer/Hide Footer commands to all context menus:
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data" ContextMenus="GridContextMenus.All" CustomizeContextMenu="OnCustomizeContextMenu">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" />
<DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" />
<DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" />
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover" />
</Columns>
<TotalSummary>
<DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Date" />
</TotalSummary>
</DxGrid>
@code {
object Data { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
void OnCustomizeContextMenu(GridCustomizeContextMenuEventArgs args) {
var isFooterVisible = args.Context.Grid.FooterDisplayMode != GridFooterDisplayMode.Never;
string footerItemText = isFooterVisible ? "Hide Footer" : "Show Footer";
var newState = isFooterVisible ? GridFooterDisplayMode.Never : GridFooterDisplayMode.Always;
args.Items.AddCustomItem(0, footerItemText, () => {
args.Context.Grid.BeginUpdate();
args.Context.Grid.FooterDisplayMode = newState;
args.Context.Grid.EndUpdate();
});
}
}
Inheritance
Object
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridCommandContextBase
GridCommandContext
See Also