Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
[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