Skip to main content
All docs
V25.2
  • GridGroupFooterCommandContext.Grid Property

    Returns the Grid object.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    public IGrid Grid { get; }

    Property Value

    Type Description
    IGrid

    The Grid object.

    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.

    When the target element is a group footer cell, the Context property returns a GridGroupFooterCommandContext object. Use the object’s Grid property to access the Grid and its extensive API.

    Example

    The following example adds custom Show Group Panel/Hide Group Panel commands to the group footer context menu:

    @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>
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Date" FooterColumnName="Date" />
        </GroupSummary>
    </DxGrid>
    
    @code {
        private List<WeatherForecast>? forecasts;
    
        protected override async Task OnInitializedAsync() {
            forecasts = await ForecastService.GetForecastAsync();
        }
        void OnCustomizeContextMenu(GridCustomizeContextMenuEventArgs args) {
            if (args.Context is GridGroupFooterCommandContext footerContext) {
                var isGroupPanelVisible = footerContext.Grid.ShowGroupPanel;
                string itemText = isGroupPanelVisible ? "Hide Group Panel" : "Show Group Panel";
                args.Items.AddCustomItem(0, itemText, () => {
                    footerContext.Grid.BeginUpdate();
                    footerContext.Grid.ShowGroupPanel = !isGroupPanelVisible;
                    footerContext.Grid.EndUpdate();
                });
            }
        }
    }
    

    Implements

    See Also