Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor fluent ui DialogService, error

$
0
0

I am using .net8 and blazor with Fluent UI library and I get an error that no provider is found even though I added it to App.razor at the end of MainLayout.

Program.cs

builder.Services.AddHttpClient();builder.Services.AddFluentUIComponents();

App.razor

<script src="_content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type="text/javascript"></script><script src="_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js" type="module" async></script>

MainLayout.razor

<FluentLayout><FluentHeader><Header/></FluentHeader><FluentStack Orientation="Orientation.Horizontal" Width="100%" Class="page--container"><NavMenu/><FluentBodyContent>            @Body</FluentBodyContent></FluentStack></FluentLayout><FluentDialogProvider/><FluentToastProvider/><FluentTooltipProvider/>

Header.razor

[Inject] public IDialogService DialogService { get; set; }private async Task ToggleThemeHandler(){    var dialog = DialogService.ShowDialogAsync<MenuPanel>(new DialogParameters    {        Alignment = HorizontalAlignment.Right    });    await dialog;}

MenuPanel.razor

@implements IDialogContentComponent<FluentDialogBody>    Menu</FluentDialogBody>

IDE Console

Unhandled exception rendering component: <FluentDialogProvider /> needs to be added to the main layout of your application/site. (Parameter 'OnShowAsync')System.ArgumentNullException: <FluentDialogProvider /> needs to be added to the main layout of your application/site. (Parameter 'OnShowAsync') at Microsoft.FluentUI.AspNetCore.Components.DialogService.ShowDialogAsync[TData](Type dialogComponent, TData data, DialogParameters parameters) in /_/src/Core/Components/Dialog/Services/DialogService-Dialog.cs:line 17 at Microsoft.FluentUI.AspNetCore.Components.DialogService.ShowDialogAsync[TDialog](DialogParameters parameters) in /_/src/Core/Components/Dialog/Services/DialogService-Dialog.cs:line 35 at Components.Layouts.MainLayout.Components.Header.ToggleThemeHandler() in **\Components\Layouts\MainLayout\Components\Header.razor:line 36

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>