Skip to main content

DxDropDown.BodyTemplate Property

Specifies a template for the drop-down window’s body. Replaces the default render fragment (including paddings, scrollbars, etc.)

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<IPopupElementInfo> BodyTemplate { get; set; }

Property Value

Type Description
RenderFragment<IPopupElementInfo>

The body template.

Remarks

Use the BodyTemplate property to display any render fragment in the drop-down window’s body element. This template changes the default body element rendering, including paddings, scrollbar, and inner content alignment. If you need to place custom content in the drop-down window’s body element but retain the default rendering of UI elements in it, use the BodyContentTemplate instead.

The BodyTemplate has the context parameter. You can use the parameter’s CloseCallback property to implement a custom close button.

<DxButton Id="showDDbtton" Click="() => IsOpenWindow = true">Show DropDown</DxButton>
<DxDropDown Width="400"
            @bind-IsOpen="@IsOpenWindow"
            PositionTarget="#showDDbtton"
            PositionMode="DropDownPositionMode.Bottom">
    <BodyTemplate>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        Mauris sit amet metus velnisi blandit tincidunt vel efficitur purus.
        Nunc nec turpis tempus, accumsan orci auctor,
        imperdiet mauris. Fusce id purus magna.
    </BodyTemplate>
</DxDropDown>

@code {
    bool IsOpenWindow { get; set; } = false;
}

Blazor DropDown Body Template

The BodyTemplate property has priority over BodyText, BodyTextTemplate, and BodyContentTemplate properties.

See Also