Skip to main content

DxPopupBase.Showing Event

Fires before the Popup is displayed.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<PopupShowingEventArgs> Showing { get; set; }

Event Data

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

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
CancellationToken Specifies an object that propagates a cancellation notification.

Remarks

Handle the Showing event to process show actions. You can set the event argument’s Cancel property to true to cancel a show action. This event occurs in the following cases:

You can also handle the Shown event that fires after the Popup is displayed. To process close actions, handle the Closing and Closed events.

The following example allows users to display the Popup only after they enable the checkbox:

Blazor Popup Show Events

<div>
    <DxCheckBox @bind-Checked="@Checked">
        Allow Popup
    </DxCheckBox>
    @*...*@
    <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="Show"
              Click="() => PopupVisible = true"/>
</div>

<DxPopup @bind-Visible="@PopupVisible"
         HeaderText="Header"
         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."
         Showing="PopupShowing"
         Shown="PopupShown">
</DxPopup>
@code {
    bool Checked { get; set; }
    bool PopupVisible { get; set; }

    void PopupShowing(PopupShowingEventArgs args) {
        args.Cancel = !Checked;
    }

    void PopupShown(PopupShownEventArgs args) {
        Checked = false;
    }
}
See Also