Skip to main content

DxFlyout.CloseAsync(CancellationToken) Method

Asynchronously closes the flyout window.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task<bool> CloseAsync(
    CancellationToken token = default(CancellationToken)
)

Optional Parameters

Name Type Default Description
token CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
Task<Boolean>

An asynchronous operation that closes the window and returns true if the operation is successful; otherwise, it returns false.

Remarks

Call the ShowAsync and CloseAsync methods to show and close the flyout window asynchronously.

<DxButton Text="Show" Click="ShowWindow" />
<DxButton Text="Hide" Click="HideWindow" />

<DxFlyout @ref="flyoutWindow" Width="400" CloseOnOutsideClick="false"
            BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit." />

@code {
    DxFlyout flyoutWindow { get; set; }

    async Task ShowWindow(MouseEventArgs args) {
        if (!flyoutWindow.IsInitialized)
            await flyoutWindow.InitializedTask;
            await flyoutWindow.ShowAsync();
    }
    async Task HideWindow(MouseEventArgs args) {
        await flyoutWindow.CloseAsync();
    }
}

You can handle the following events related to ShowAsync and CloseAsync methods:

Showing
Fires before the flyout window is displayed.
Shown
Fires after the flyout window is displayed.
Closing
Fires before the flyout window is closed.
Closed
Fires after the flyout window is closed.

To show and close the flyout window synchronously, implement two-way binding for the IsOpen property.

See Also