protected override async Task OnParametersSetAsync() { await base.OnParametersSetAsync(); if (Toolbar != null) { var toolbarItems = await PageToolbarManager.GetItemsAsync(Toolbar); ToolbarItemRenders.Clear(); foreach (var item in toolbarItems) { var sequence = 0; ToolbarItemRenders.Add(builder => { builder.OpenComponent(sequence, item.ComponentType); if (item.Arguments != null) { foreach (var argument in item.Arguments) { sequence++; builder.AddAttribute(sequence, argument.Key, argument.Value); } } builder.CloseComponent(); }); } } }
protected async override Task OnInitializedAsync() { var toolbar = await ToolbarManager.GetAsync(StandardToolbars.Main); ToolbarItemRenders.Clear(); foreach (var item in toolbar.Items) { ToolbarItemRenders.Add(builder => { builder.OpenComponent(0, item.ComponentType); builder.CloseComponent(); }); } }