Skip to main content
All docs
V24.2

DxComboBox<TData, TValue>.GroupHeaderDisplayTemplate Property

Specifies the template used to display group headers when ComboBox items are grouped.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<ComboBoxGroupHeaderDisplayTemplateContext> GroupHeaderDisplayTemplate { get; set; }

Property Value

Type Description
RenderFragment<ComboBoxGroupHeaderDisplayTemplateContext>

The template content.

Remarks

Use the GroupHeaderDisplayTemplate property to customize content displayed in ComboBox’s group headers when data items are grouped. The template’s context parameter contains the DisplayText property that allows you to get the header’s display text.

The following code organizes data items into groups based on the Country data source field and customizes displayed text for group headers:

@inject NwindDataService NwindDataService

<DxComboBox Data="@Data"
            @bind-Value="Value"
            TextFieldName="@nameof(Customer.ContactName)"
            GroupFieldName="@nameof(Customer.Country)"
            SearchMode="@ListSearchMode.AutoSearch"
            SearchFilterCondition="@ListSearchFilterCondition.Contains"
            InputId="cbGrouping">
    <GroupHeaderDisplayTemplate>
        Country: @context.DisplayText
    </GroupHeaderDisplayTemplate>
</DxComboBox>

@code {
    IEnumerable<Customer> Data { get; set; }
    Customer Value { get; set; }
    protected override async Task OnInitializedAsync() {
        Data = await NwindDataService.GetCustomersAsync();
        Value = Data.FirstOrDefault(x => x.Country == "Argentina");
    }
}

ComboBox - Group Data

See Also