.NET MAUI Application Types

.NET Multi-platform App UI (.NET MAUI) is an open-source, cross-platform framework for creating native mobile and desktop applications with C# and XAML from a single shared codebase. It's the evolution of Xamarin.Forms, allowing you to build applications for Android, iOS, macOS, and Windows from a single project.

What is .NET MAUI?

.NET MAUI provides a unified platform to build native applications that can run on multiple operating systems. It offers:

Key Features

Cross-Platform UI Controls

.NET MAUI includes a comprehensive set of built-in UI controls that render natively on each target platform. These controls are designed to be flexible and customizable.

Example of a button:

<Button Text="Click Me"
                    HorizontalOptions="Center"
                    VerticalOptions="Center" />

XAML for UI Definition

XAML (eXtensible Application Markup Language) is a declarative language that allows you to design your application's user interface separately from its business logic. This separation improves maintainability and collaboration.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                         x:Class="MyMauiApp.Views.HomePage"
                         Title="Home">
    <StackLayout>
        <Label Text="Welcome to .NET MAUI!"
               FontSize="32"
               HorizontalOptions="Center" />
        <Button Text="Go to Settings"
                Clicked="OnSettingsClicked"
                HorizontalOptions="Center" />
    </StackLayout>
</ContentPage>

C# for Logic and Behavior

Your application's logic, event handling, and data manipulation are written in C#. .NET MAUI seamlessly integrates C# code-behind with XAML views.

public partial class HomePage : ContentPage
{
    public HomePage()
    {
        InitializeComponent();
    }

    private void OnSettingsClicked(object sender, EventArgs e)
    {
        // Navigation logic here
        Navigation.PushAsync(new SettingsPage());
    }
}

Platform-Specific Development

While .NET MAUI aims for maximum code sharing, you can still access platform-specific APIs and features when needed. This allows you to tailor your application to the unique capabilities of each operating system.

Note: .NET MAUI builds upon the foundation of Xamarin.Forms. If you have experience with Xamarin.Forms, you'll find many similarities and improvements in .NET MAUI.

Supported Platforms

Next Steps

Ready to start building? Explore the following sections: