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

DxPopupBase.HeaderContentTemplate Property

Specifies the template used to display the header’s content area.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Description
RenderFragment<IPopupElementInfo>

The template.

Remarks

Use the HeaderContentTemplate property to customize the headers’s content area. This area does not include the Close button. Predefined content alignment and paddings apply to the header. In the template, you can display any UI fragment (formatted text, images, another component, and so on). The template accepts an IPopupElementInfo object as the context parameter. You can use the parameter’s CloseCallback property to implement the Close button.

The following image highlights the content area of Popup elements in red.

Blazor Popup Content Area

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.">
    <HeaderContentTemplate>
        <h2>Header</h2>
    </HeaderContentTemplate>
</DxPopup>

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

Blazor Popup Header Content 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. The HeaderContentTemplate property takes priority over the HeaderText property.
  • HeaderTemplate - Allows you to customize the entire header. Predefined appearance settings do not apply. This template has the highest priority over the HeaderText and HeaderContentTemplate properties.

Disable the ShowHeader property to hide the header.

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

See Also