From the course: Creating .NET MAUI Applications with Blazor

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Handling UI differences between website and app

Handling UI differences between website and app - .NET MAUI Tutorial

From the course: Creating .NET MAUI Applications with Blazor

Handling UI differences between website and app

- [Instructor] We've created a project that runs both on a mobile platform through MAUI Blazor and in a browser with Blazor WebAssembly. But we probably don't want all systems to have exactly the same UI. In fact, the expectations can change quite frequently by platform. How should we handle this? In a normal MAUI app, we may want to use pre compilation directives but that won't work in our Razor class library. It needs to be able to run on all platforms at compiled time. Additionally, the library project can't access anything that isn't available on both the MAUI and the Blazor WebAssembly versions of .net. So what can we do? Once again, creating an interface with different implementations will come to our rescue. If we look at the start code for this video, we can see an interface has been added to the core project and this interface is iPlatformHhelper. This interface returns information about what environment the…

Contents