microsoft3 min read

.NET MAUI Tutorial: Build Cross-Platform Native UIs from Scratch (2026)

.NET MAUI Tutorial: Build Cross-Platform Native UIs from Scratch (2026)

Published:  |  Category: Microsoft  |  Reading time: ~15 min
.NET MAUI Tutorial: Build Cross-Platform Native UIs from Scratch (2026)

When I built my first mobile app with Xamarin.Forms, I loved the idea of sharing code across platforms but felt the friction of bridging native controls. .NET MAUI takes everything good about Xamarin.Forms and makes it cleaner, faster, and truly native. I have shipped MAUI apps to iOS, Android, Windows, and macOS from a single codebase.

.NET MAUI is Microsoft's framework for building native cross-platform applications with .NET. Share business logic, data access, and UI layout across platforms while retaining access to platform-specific APIs. With hot reload and single-project structure, MAUI is the most productive way to target every Microsoft platform.

Project Structure and Single-Project Architecture

A .NET MAUI project consolidates everything into one project. Under Platforms/, find platform-specific directories. Shared code lives at the project root — XAML pages, ViewModels, services, and resources compile for all targets. Use conditional compilation with #if ANDROID, #if IOS for platform-specific code.


    net8.0-android;net8.0-ios;net8.0-maccatalyst
    true
  

XAML UI Layout and Controls

Define UI with layout containers like VerticalStackLayout, Grid, and FlexLayout. Each control maps to a native control. Grid supports rows and columns with star and auto sizing. New controls include Border, GraphicsView, SwipeView, and RefreshView. Styles and templates keep UI consistent.


    
        

MVVM Architecture and Data Binding

MVVM is the standard architecture. Views are XAML pages, ViewModels expose properties and commands, Models hold data. Data binding connects Views to ViewModels declaratively. CommunityToolkit.Mvvm provides source generators eliminating boilerplate with [ObservableProperty] and [RelayCommand].

public partial class MainViewModel : ObservableObject
{
    [ObservableProperty]
    private string userName = string.Empty;
    [ObservableProperty]
    private ObservableCollection products = new();
    [RelayCommand]
    private async Task LoadProducts()
    {
        Products.Clear();
        var items = await _productService.GetAllAsync();
        foreach (var item in items) Products.Add(item);
    }
}

Navigation and Shell

MAUI Shell provides URI-based navigation with flyout menus and tab bars. Define structure in AppShell.xaml using ShellContent and TabBar. Navigate with Shell.Current.GoToAsync supporting URI routing and parameters. Shell handles back button, deep linking, and search.


    
        
        
    

await Shell.Current.GoToAsync($"product?id={product.Id}");

Accessing Platform APIs and Dependency Injection

Essentials library provides cross-platform APIs for clipboard, geolocation, file system, and secure storage. DI is built into MAUI through Microsoft.Extensions.DependencyInjection. Register services and ViewModels in MauiProgram.cs.

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder.UseMauiApp()
           .ConfigureFonts(fonts=>fonts.AddFont("OpenSans-Regular.ttf","OpenSansRegular"));
    builder.Services.AddSingleton();
    builder.Services.AddTransient();
    builder.Services.AddTransient();
    return builder.Build();
}

Testing, Debugging, and Publishing

Unit test ViewModels with xUnit or NUnit. Hot Reload modifies XAML or C# while running. Android publishing requires a keystore, iOS needs provisioning profiles, Windows uses MSIX packaging.

dotnet build -t:Run -f net8.0-android
dotnet publish -f net8.0-android -c Release -p:AndroidSigningKeyPass=...
dotnet build -t:Run -f net8.0-windows10.0.19041.0

Frequently Asked Questions

Can I reuse existing Xamarin.Forms code in MAUI?

Most Xamarin.Forms code migrates with minor changes — namespace updates and API renames. Microsoft provides a migration guide and .NET Upgrade Assistant.

Does MAUI support hot reload on all platforms?

Hot Reload works on Android emulators, iOS simulators, and Windows. XAML changes apply instantly; C# hot reload supports method body changes.

How does MAUI compare to Flutter or React Native?

MAUI targets .NET developers with native controls. Flutter uses its own rendering engine. React Native bridges JavaScript to native controls. MAUI has tightest Microsoft ecosystem integration.

Can I use third-party native libraries in MAUI?

Yes via bindings. Android uses .jar/.aar bindings, iOS uses .xcframework bindings. Many popular libraries have community-maintained MAUI bindings.

Originally published on Ayodhyyya. Last updated June 1, 2026.