Skip to main content

DxWindow.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 window. This template changes the default header rendering, including paddings, scrollbar, and inner content alignment. If you need to place custom content in the 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.

<DxButton RenderStyle="ButtonRenderStyle.Secondary" 
          Click="() => WindowVisible = !WindowVisible">SHOW A WINDOW</DxButton>
<DxWindow @bind-Visible=WindowVisible
          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."
          Width="max(25vw, 250px)"
          BodyCssClass="body-style">
    <HeaderTemplate>
        <div style="background-color:rgb(95,54,141); color:white; padding-left:10px; font-size:20px">
            Information
        </div>
    </HeaderTemplate>
</DxWindow>

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

Blazor Window Header Template

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

HeaderText
Specifies text displayed in the Window header.
HeaderTextTemplate
Specifies the template for the Window’s header text area.
HeaderContentTemplate
Specifies a template for content of the window’s header.

The HeaderTemplate property takes priority over the HeaderText, HeaderTextTemplate, HeaderContentTemplate properties.

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

See Also