Library Blazor Components NextGrid Reference Classes GridColumn Properties CellTemplate

CellTemplate

[Parameter]
public RenderFragment<T>? CellTemplate { get; set; }

Reference to an item currently being rendered can be accessed via @context variable.

Examples

The following example demonstrates how an item of type Product (specified by typeparam T) can be accessed within single cell template, while the cell is being rendered.

<DataGrid T="Product" ItemsSource="ProductsList">
    <GridColumn HeaderText="Price" Size="60px">
        <CellTemplate>
            @context.Price <em>USD</em>
        </CellTemplate>
    </GridColumn>
</DataGrid>

Even a more complex code can be placed within the template. The following example also uses context object.

Sign in