blazor-devexpress-dot-blazor-dot-dxpopupbase-a8668965.md
Specifies a template for content of the pop-up window’s body.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public RenderFragment<IPopupElementInfo> BodyContentTemplate { get; set; }
| Type | Description |
|---|---|
| RenderFragment<IPopupElementInfo> |
The body content.
|
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.
The following image highlights the content area of pop-up elements in red:
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"
HeaderText="Header">
<BodyContentTemplate>
<i>
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.
</i>
</BodyContentTemplate>
</DxPopup>
@code {
bool PopupVisible { get; set; } = false;
}
Run Demo: Popup - Customization
You can also use the following properties to customize the body:
BodyContentTemplate property takes priority over the BodyText property.BodyText and BodyContentTemplate properties.For additional information about Popup customization, refer to the following help topic: Content and Appearance.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BodyContentTemplate property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
blazor-create-popup-dynamically/CS/DynamicPopup/Components/DxModalPopup.cs#L33
public DxModalPopup() {
this.BodyContentTemplate = new RenderFragment<IPopupElementInfo>(target => BodyContent);
this.Closed = EventCallback.Factory.Create<PopupClosedEventArgs>(this, (e) => {
See Also