Skip to main content
A newer version of this page is available. .

DxPopupBase.IsInitialized Property

Gets whether the Popup component is initialized.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public bool IsInitialized { get; }

Property Value

Type Description
Boolean

true if the component is initialized; otherwise, false.

Remarks

The Popup cannot be shown until the component is initialized. The initialization starts after the component is rendered for the first time. Once this task is completed, the Created event fires.

To track the initialization state from code, use the IsInitialized property. For example, you can check this property value before you call the ShowAsync(CancellationToken) method.

@inject IJSRuntime JsRuntime

<DxButton RenderStyle="ButtonRenderStyle.Primary" Text="Show" Click="ShowClick" />

<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."
         ShowFooter="true"
         @ref="Popup">
    <FooterContentTemplate>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="Close" Click="CloseClick" />
    </FooterContentTemplate>
</DxPopup>

@code {
    DxPopup Popup;
    bool PopupVisible { get; set; } = false;

    async Task ShowClick(MouseEventArgs args)
    {
        if (Popup.IsInitialized)
            await Popup.ShowAsync();
        else
            await JsRuntime.InvokeVoidAsync("alert", "The component has not been initialized yet. Please try later.");
    }

    async Task CloseClick(MouseEventArgs args)
    {
        await Popup.CloseAsync();
    }
}
See Also