Using MudBlazor in WPF Blazor App (Hybrid Solution)

Viewed 97

I try to build a WPF Blazor App following this MS documentation. I try to add mudblazor along this guide.

MainWindow Code Behind:

public MainWindow()
    {
        InitializeComponent();
        var serviceCollection = new ServiceCollection();
        serviceCollection.AddWpfBlazorWebView();
        serviceCollection.AddMudServices();
        Resources.Add("services", serviceCollection.BuildServiceProvider());
    }

Counter Razor Component:

<MudText Typo="Typo.h1">Counter</MudText>

<MudText Typo="Typo.h5">Current state: @currentCount</MudText>

<MudButton Variant="Variant.Filled" Color="Color.Secondary" 
@onclick="IncrementCount">Click me</MudButton>

@code {
   private int currentCount = 0;

   private void IncrementCount()
   {
       currentCount++;
   }
}

The MudBlazor magic is sadly not visible, the result is :

enter image description here

Where I`m wrong?

0 Answers
Related