MauiApp is the application object returned by CreateMauiApp in MauiProgram.cs. The method builds it through the .NET generic host pattern, and the resulting object starts the .NET MAUI application. section 2.3
Creating the application
A typical startup method creates a builder, applies UseMauiApp<App>(), configures fonts, and returns builder.Build() as a MauiApp. The App object then assigns a Page to its MainPage member for display. section 2.3
Listing 2.1 MauiProgram.cs
namespace AlohaWorld;
public static class MauiProgram
{
public static MauiApp CreateMauiApp() #1
{
var builder = MauiApp.CreateBuilder(); #2
builder
.UseMauiApp<App>() #3
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
return builder.Build(); #4
}
}
Inspect the complete MauiProgram.cs startup flow, including builder creation, application registration, font configuration, and construction of the MauiApp object. section 2.3
