Back to Devexpress

PopupClosingEventArgs Class

blazor-devexpress-dot-blazor-67b9ab41.md

latest4.1 KB
Original Source

PopupClosingEventArgs Class

Contains data for the Closing event.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public class PopupClosingEventArgs :
    CancelEventArgs

PopupClosingEventArgs is the data class for the following events:

Remarks

The Closing event is raised before the Popup is closed. Use the event argument’s CloseReason property to identify which action closes the Popup. You can set the Cancel property to true to cancel a close action.

Close ReasonDescription
CloseButtonClickA user clicks the Close button in the Popup header or clicks a custom button (if you call the predefined CloseCallback to create this button).
EscapePressA user presses Escape.
OutsideClickA user clicks outside the Popup’s boundaries.
ProgrammaticallyYou set the Visible property to false or call the CloseAsync method.

You can also handle the Closed event that fires after the Popup is closed.

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

Inheritance

Object EventArgs CancelEventArgs PopupClosingEventArgs

See Also

PopupClosingEventArgs Members

DevExpress.Blazor Namespace