<CascadingValue Value="@this">
<div class="sidebar">
<NavMenu />
</div>
<div class="main">
<div class="top-row px-4">
<a rel='nofollow' rel='nofollow' href=https://docs.microsoft.com/aspnet/ target="_blank">About</a>
</div>
<div class="content px-4">
@Body
</div>
<SfSpinner @bind-Visible="@SpinnerVisible" CssClass="e-spin-overlay">
</SfSpinner>
</div>
</CascadingValue>
@code{
public bool SpinnerVisible { get; set; } = false;
public async Task ClickHandler()
{
this.SpinnerVisible = true;
StateHasChanged();
await Task.Delay(2000);
this.SpinnerVisible = false;
StateHasChanged();
}
} |
@using Syncfusion.Blazor.Buttons
<div>
<p>Click the button to show the spinner</p>
<SfButton @onclick="@ClickHandler">Show/Hide Spinner</SfButton>
</div>
@code{
[CascadingParameter]
public MainLayout mainLayoutObj { get; set; }
private async Task ClickHandler()
{
await mainLayoutObj.ClickHandler();
}
protected async override Task OnInitializedAsync()
{
await mainLayoutObj.ClickHandler();
}
} |
Thank you
My query is about how to align the loading spinner in the middle of page.
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.Spinner
<div>
<p>Click the button to show the spinner</p>
<SfButton @onclick="@ClickHandler">Show/Hide Spinner</SfButton>
<div id="SpinTarget" style="position: relative; height: 400px; border: 1px solid black">
<SfSpinner @bind-Visible="@SpinnerVisible" CssClass="e-spin-overlay">
</SfSpinner>
</div>
</div>
@code{
public bool SpinnerVisible { get; set; } = false;
public async Task ClickHandler()
{
SpinnerVisible = true;
this.StateHasChanged();
await Task.Delay(2000);
SpinnerVisible = false;
this.StateHasChanged();
}
}
|
I want the loadin spinner in the middle of the page
#spintarget {
left: 50%;
position: absolute;
text-align: center;
top: 50%;
} |