Search results

Show Dialog with fullscreen in Blazor Dialog component

You can show the dialog in fullscreen by passing true as argument to the dialog Show method. By using Visible property you can prevent the dialog from showing initially.

@using Syncfusion.Blazor
@using Syncfusion.Blazor.Popups
@using Syncfusion.Blazor.Buttons

<SfButton @onclick="@OnBtnClick">Open</SfButton>
<SfDialog @ref="@dialogObj" Width="250px" ShowCloseIcon="true" @bind-Visible="@isVisible">
    <DialogTemplates>
        <Header> Dialog</Header>
        <Content> This is a Dialog with button and primary button</Content>
    </DialogTemplates>
    <DialogButtons>
        <DialogButton OnClick="@OnClick">
            <DialogButtonModel Content="OK" IsPrimary="true"></DialogButtonModel>
        </DialogButton>
        <DialogButton OnClick="@OnClick">
            <DialogButtonModel Content="Cancel"></DialogButtonModel>
        </DialogButton>
    </DialogButtons>
</SfDialog>

@code {
    private SfDialog dialogObj;
    private bool isVisible { get; set; } = false;
    private void OnClick()
    {
        this.isVisible = false;
    }

    private void OnBtnClick()
    {
        this.dialogObj.Show(true);
    }
}