liveBook · Manning

UseMauiApp

As explained in .NET MAUI in Action

UseMauiApp is a .NET MAUI host-builder extension method that registers an application type for the host.

UseMauiApp is a .NET MAUI host-builder extension method that registers the application type used to launch an app. It receives App as its type parameter; App implements IApplication through the Application base class. section 2.3

Registering App in MauiProgram.cs

Call UseMauiApp<App>() while configuring the MauiApp builder, then build the host. The App constructor assigns a ContentPage instance to MainPage, which .NET MAUI displays after loading. section 2.3

Figure 2.13 In a .NET MAUI app, MauiProgram is the entry point, which launches App, which displays MainPage.

Follow the startup chain from MauiProgram through App to the page assigned to MainPage. section 2.3

How .NET MAUI in Action covers it

How deep it goes
Explains the generic call, interface requirement, and resulting page flow, but does not detail the extension method’s internals.
Examples
Uses MauiProgram.cs with UseMauiApp<App>() and App.xaml.cs assigning new MainPage() to MainPage.
What it assumes
Assumes basic C# types and inheritance while explaining the application interface relationship from the app template.
What you can do after
Operate/configure a .NET MAUI host by registering App and connecting it to the initial page.
How it connects
Connects host builders, MauiApp, IApplication, Application, App, ContentPage, and MainPage.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.