Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@enchev @akorchev
57 lines (46 sloc) 1.83 KB
@page "/dialog"
@using NorthwindBlazor.Data
@using NorthwindBlazor.Models.Northwind
@using Microsoft.EntityFrameworkCore
@inject DialogService dialogService
<h1 style="display:inline">Dialog</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/DialogPage.razor" target="_blank">[source code]</a>
<p>This page demonstrates <b>Dialog</b> component.</p>
<RadzenCard>
<div class="row">
<div class="col-md-6">
<h3>Dialog</h3>
<RadzenButton Text=@($"Show OrderID: {orderID} details") Click="@(args => dialogService.Open<DialogCardPage>($"Order {orderID}",
new Dictionary<string, object>() { { "OrderID", orderID } },
new DialogOptions(){ Width = "700px", Height = "530px", Left = "30%", Top = "20%" }))" />
</div>
<div class="col-md-6">
<h3>Events</h3>
<RadzenCard style="overflow: auto;height:500px;">
@foreach (var e in events.OrderByDescending(i => i.Key))
{
@e.Value
<br />
}
</RadzenCard>
</div>
</div>
</RadzenCard>
@code {
int orderID = 10248;
Dictionary<DateTime, string> events = new Dictionary<DateTime, string>();
protected override void OnInitialized()
{
dialogService.OnOpen += Open;
dialogService.OnClose += Close;
}
async void Open(string title, Type type, Dictionary<string, object> parameters, DialogOptions options)
{
events.Add(DateTime.Now, "Dialog opened");
await InvokeAsync(() => { StateHasChanged(); });
}
async void Close(dynamic result)
{
events.Add(DateTime.Now, "Dialog closed. Result: " + result);
await InvokeAsync(() => { StateHasChanged(); });
}
}
You can’t perform that action at this time.