Back to Devexpress

DxWindow.BodyContentTemplate Property

blazor-devexpress-dot-blazor-dot-dxwindow-2ef2ab7e.md

latest2.7 KB
Original Source

DxWindow.BodyContentTemplate Property

Specifies a template for content of the window’s body.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDescription
RenderFragment<IPopupElementInfo>

The body content.

|

Remarks

Use the BodyContentTemplate property to display any render fragment in the body’s content area. This template does not affect the default content area rendering (that is, paddings, alignment, etc.)

The BodyContentTemplate accepts an IPopupElementInfo object as the context parameter. You can use the parameter’s CloseCallback property to implement the Close button.

razor
<DxButton RenderStyle="ButtonRenderStyle.Secondary" 
          Click="() => WindowVisible = !WindowVisible">SHOW A WINDOW</DxButton>
<DxWindow @bind-Visible=WindowVisible
          HeaderText="Edit Contact"
          ShowFooter=true
          Width="500px">
    <BodyContentTemplate Context="Context">
        <DxFormLayout>
            <DxFormLayoutItem Caption="Contact Name:" ColSpanMd="12">
                <DxTextBox Text="Nancy Davolio" />
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Birth Date:" ColSpanMd="12">
                <DxDateEdit Date="DateTime.Now.AddYears(-30)" />
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Years Worked:" ColSpanMd="12">
                <DxSpinEdit Value="3" />
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Email:" ColSpanMd="12">
                <DxTextBox Text="[email protected]" />
            </DxFormLayoutItem>
        </DxFormLayout>
    </BodyContentTemplate>
    <FooterContentTemplate>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="@context.CloseCallback" />
        <DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="@context.CloseCallback" />
    </FooterContentTemplate>
</DxWindow>

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

See Also

DxWindow Class

DxWindow Members

DevExpress.Blazor Namespace