Skip to main content

DxPopupBase.HeaderTemplate Property

Specifies a template for the window’s header. 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> HeaderTemplate { get; set; }

Property Value

Type Description
RenderFragment<IPopupElementInfo>

The header template.

Remarks

Use the HeaderTemplate property to display any UI render fragment in the header element of the pop-up window. This template changes the default header rendering, including paddings, scrollbar, and inner content alignment. If you need to place custom content in the pop-up window header but retain its default rendering, use the HeaderContentTemplate instead.

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

Implement two-way binding for the Visible property to show the Popup in code and update the property value when a user closes the Popup.

<div @onclick="@(() => PopupVisible = true)">
    <p>CLICK TO SHOW A POP-UP WINDOW</p>
</div>

<DxPopup @bind-Visible="@PopupVisible"
         BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit amet metus vel
             nisi blandit tincidunt vel efficitur purus. Nunc nec turpis tempus, accumsan orci auctor,
             imperdiet mauris. Fusce id purus magna."
         ShowFooter="true">
    <HeaderTemplate>
        <div style="background-color:rgb(95,54,141); color:white; padding-left:10px; font-size:20px">
            Information
        </div>
    </HeaderTemplate>
    <FooterContentTemplate>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK"
                  Click="@context.CloseCallback" />
    </FooterContentTemplate>
</DxPopup>

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

Blazor Popup Header Template

Run Demo: Popup - Customization

You can also use the following properties to customize the header:

  • HeaderText - Allows you display plain text and applies all predefined appearance settings.
  • HeaderContentTemplate - Allows you to customize the header’s content area and applies predefined content alignment and paddings.

The HeaderTemplate property takes priority over the HeaderText and HeaderContentTemplate properties.

For more information about Popup customization, refer to the following help topic: Content and Appearance.

See Also