Skip to main content
A newer version of this page is available. .

DxWindow.BodyTemplate Property

Specifies the template used to display the entire body.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Description
RenderFragment<IPopupElementInfo>

The template content.

Remarks

Use the BodyTemplate property to display any UI fragment (for instance, formatted text, images, or another component) in the body element of the Window component. The template has the context parameter. You can use the parameter’s CloseCallback property to implement the Close button.

The BodyTemplate property has priority over the BodyText and BodyTextTemplate properties.

<DxButton RenderStyle="ButtonRenderStyle.Secondary" 
          Click="() => WindowVisible = !WindowVisible">SHOW A WINDOW</DxButton>
<DxWindow @bind-Visible=WindowVisible
          HeaderText="Edit Contact"
          ShowFooter=true
          Width="500px">
    <BodyTemplate Context="Context">
        <div style="padding: 20px">
            <DxFormLayout>
                <DxFormLayoutItem Caption="Contact Name:" ColSpanMd="12">
                    <Template>
                        <DxTextBox Text="Nancy Davolio" />
                    </Template>
                </DxFormLayoutItem>
                <DxFormLayoutItem Caption="Birth Date:" ColSpanMd="12">
                    <Template>
                        <DxDateEdit Date="DateTime.Now.AddYears(-30)" />
                    </Template>
                </DxFormLayoutItem>
                <DxFormLayoutItem Caption="Years Worked:" ColSpanMd="12">
                    <Template>
                        <DxSpinEdit Value="3" />
                    </Template>
                </DxFormLayoutItem>
                <DxFormLayoutItem Caption="Email:" ColSpanMd="12">
                    <Template>
                        <DxTextBox Text="NancyDavolio@sample.com" />
                    </Template>
                </DxFormLayoutItem>
            </DxFormLayout>
        </div>
    </BodyTemplate>
    <FooterTextTemplate>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="@context.CloseCallback" />
        <DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="@context.CloseCallback" />
    </FooterTextTemplate>
</DxWindow>

@code {
    bool WindowVisible { get; set; } = false;
}
See Also