Skip to main content

GridColumnHeaderCaptionTemplateContext Class

Stores information about a column header’s caption and is passed as the context parameter to the DxGrid.ColumnHeaderCaptionTemplate and DxGridColumn.HeaderCaptionTemplate.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public class GridColumnHeaderCaptionTemplateContext :
    GridColumnHeaderCaptionTemplateContextBase

Remarks

The DxGrid.ColumnHeaderCaptionTemplate and DxGridColumn.HeaderCaptionTemplate accept a GridColumnHeaderCaptionTemplateContext object as the context parameter. You can use the parameter’s members to get information about the caption of the column header.

The following example shows the tooltip when a user hovers the mouse pointer over any column caption:

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="@Data">
    <Columns>
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="Title" />
        <DxGridDataColumn FieldName="BirthDate" />
        <DxGridDataColumn FieldName="HireDate" />
    </Columns>
    <ColumnHeaderCaptionTemplate>
        <span title="Click the header to sort data by this column. Drag and drop the header to change the column's position">
            @context.Caption</span>
    </ColumnHeaderCaptionTemplate>
</DxGrid>

@code {
    IEnumerable<Employee> Data { get; set; }
    NorthwindContext Northwind { get; set; }
    Employee CurrentEmployee { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Employees
            .ToList();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

Blazor Grid Column Header Caption Template

Run Demo: Grid - Column Templates

Inheritance

Object
DevExpress.Blazor.Internal.GridTemplateContextBase
DevExpress.Blazor.Internal.GridColumnHeaderCaptionTemplateContextBase
GridColumnHeaderCaptionTemplateContext
See Also