Posts about .NET MAUI

Shared Blazor WebAssembly and Hybrid code

March 24th 2023 Blazor .NET MAUI

The Blazor WebAssembly and Blazor Hybrid hosting models have a lot in common, and if you want to offer your application as both a SPA (or even a PWA) and a (hybrid) native application, you can share a lot of code between the two. Unfortunately, there is no project template with everything set up for you, but there is official documentation on how to do it yourself.

Platform code in Blazor Hybrid

March 17th 2023 Blazor .NET MAUI

The new Blazor Hybrid hosting model allows seamless execution of native platform code from Blazor pages and components. This is also made clear in the official documentation. Surprisingly, I could not find an example or tutorial for this, so I decided to create one myself.

Avoid async calls in view model constructors

October 21st 2022 MVVM .NET MAUI

The view models in the MVVM pattern are responsible for providing data for the view. It may be tempting to load the data in the constructor of the view model. But if the methods to load the data are asynchronous, they must then be called in a blocking manner. Even if we ignore the danger of deadlock, this is not a good idea.

Fix broken .NET MAUI templates

September 9th 2022 .NET MAUI Visual Studio

When I started working with .NET MAUI, I immediately noticed that the code files generated by the project template use tabs instead of spaces for indentation (unlike all other .NET project templates). This bothered me, but fortunately it can be easily fixed.