Skip to main content

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

DxAccordion.ItemTemplate Property

Specifies the template used to display Accordion items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public RenderFragment<IAccordionItemInfo> ItemTemplate { get; set; }

#Property Value

Type Description
RenderFragment<IAccordionItemInfo>

The item template.

#Remarks

Use the ItemTemplate to specify the template for an item’s header and content.

The following example applies the ItemTemplate:

<style>
    .my-class {
        margin-bottom: 5px;
    }
</style>
<div class="cw-480">
    <DxAccordion Data=@DataSource>
        <DataMappings>
            <DxAccordionDataMapping Key="LastName" 
                                    Text="LastName" />
        </DataMappings>
        <ItemTemplate>
            @{
                var dataItem = (Employee)context.DataItem;
            }
            <div class="my-class">
                <EmployeeCard EmployeeInfo=dataItem />
            </div>
        </ItemTemplate>
    </DxAccordion>
</div>

Template for all items

If you want to specify custom item content or header text only, use the ItemContentTemplate or ItemHeaderTextTemplate property.

If you want to specify the template for all items, use the Template.

See Also