Back to Devexpress

DxPopupBase.Closed Event

blazor-devexpress-dot-blazor-dot-dxpopupbase-b60f7a5d.md

latest4.7 KB
Original Source

DxPopupBase.Closed Event

Fires after the Popup is closed.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public EventCallback<PopupClosedEventArgs> Closed { get; set; }

Event Data

The Closed event's data class is PopupClosedEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancellationTokenSpecifies an object that propagates a cancellation notification.

Remarks

Handle the Closed event to process close actions. This event occurs in the following cases:

  • A user closes the Popup: clicks the Close button, clicks outside the Popup boundaries, or presses Escape.
  • You set the Visible property to false.
  • You call the CloseAsync method.
  • The Popup is closed in a custom way (the CloseCallback is called from any template).

You can also handle the Closing event that fires before the Popup is closed and allows you to cancel this action. To process show actions, handle the Showing and Shown events.

In the following example, neither the Close button in the header nor the custom OK button closes the Popup until a user enables the checkbox in the footer.

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

<DxPopup @bind-Visible="@EulaVisible"
         ShowFooter="true"
         HeaderText="DevExpress EULA"
         Closing="EulaPopupClosing"
         Closed="EulaPopupClosed">
    <BodyContentTemplate>
        <p>
            The terms of our license are fully outlined/described in the Developer Express Inc End User
            License Agreement (EULA) included with our product installations. Before you can install and use
            a Developer Express Inc product, you must read, understand and accept the terms/conditions of
            our EULAs. <a target="" _blank"" rel="" noopener noreferrer"" href=""
                          https: //www.devexpress.com/support/eulas/"">More info...</a>
        </p>
    </BodyContentTemplate>
    <FooterContentTemplate Context="Context">
        <DxCheckBox class="my-margin" @bind-Checked="@EulaAccepted">
            I accept the terms of the EULA
        </DxCheckBox>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" />
    </FooterContentTemplate>
</DxPopup>
@code {
    bool EulaAccepted { get; set; }
    bool EulaVisible { get; set; }

    void EulaPopupClosed(PopupClosedEventArgs args) {
        EulaAccepted = false;
    }
    void EulaPopupClosing(PopupClosingEventArgs args) {
        args.Cancel = !EulaAccepted;
    }
}
css
.my-margin {
    margin-left: 0; 
    margin-right: auto;
}

Run Demo: Popup - Response to Show and Close Actions

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Closed event.

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#L34

csharp
this.BodyContentTemplate = new RenderFragment<IPopupElementInfo>(target => BodyContent);
this.Closed = EventCallback.Factory.Create<PopupClosedEventArgs>(this, (e) => {
    OnClosed(e);

See Also

DxPopupBase Class

DxPopupBase Members

DevExpress.Blazor Namespace