What is .NET MAUI?

Beginner 15 min read Lesson 1 of 8

Introduction to .NET MAUI

.NET MAUI (.NET Multi-platform App UI) is a cross-platform framework for building mobile and desktop applications using C# and XAML. It's the evolution of Xamarin.Forms and allows you to create apps that run on Android, iOS, macOS, and Windows from a single codebase.

Key Concept

"Write once, run anywhere" - .NET MAUI enables you to share up to 90% of your code across all platforms.

Why Choose .NET MAUI?

Single Codebase

One codebase for all platforms using C# and XAML

Performance

Native performance with platform-specific optimizations

Modern UI

Rich, responsive UI with platform-adaptive controls

Native Features

Access to platform-specific APIs and features

Cloud Integration

Seamless integration with Azure and cloud services

Developer Tools

Rich tooling in Visual Studio with debugging and hot reload

MAUI Architecture

// Project Structure
MyMauiApp/
├── MyMauiApp.csproj
├── App.xaml
├── App.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── Platforms/
│   ├── Android/
│   │   └── MainActivity.cs
│   ├── iOS/
│   │   └── AppDelegate.cs
│   ├── MacCatalyst/
│   │   └── AppDelegate.cs
│   └── Windows/
│       └── MainWindow.xaml
├── Models/
│   └── (Data models)
├── ViewModels/
│   └── (View models for MVVM)
└── Views/
    └── (Pages and controls)

Platforms Supported

  • Android - Supports API level 21+ (Android 5.0+)
  • iOS - Supports iOS 13+ and iPadOS 13+
  • macOS - Mac Catalyst (macOS 11+)
  • Windows - Windows 10+ and Windows 11

MAUI vs Xamarin.Forms

Feature Xamarin.Forms .NET MAUI
Framework Xamarin .NET 6+
Desktop Support Limited Full (Windows, macOS)
Performance Good Better
Hot Reload Limited Full support
Modernization Legacy Modern .NET
Controls Extensive More modern

Getting Started with MAUI

// Create a new MAUI project
dotnet new maui -n MyMauiApp

// Build and run
cd MyMauiApp
dotnet build
dotnet run

// Or use Visual Studio
// 1. Create New Project
// 2. Select ".NET MAUI App"
// 3. Configure project settings
// 4. Click Create
Key Takeaway

.NET MAUI is the future of cross-platform development from Microsoft. It combines the best of mobile and desktop development with modern .NET capabilities.

Exercise

Explore .NET MAUI:

  1. Install .NET MAUI workloads
  2. Create a new MAUI project
  3. Explore the project structure
  4. Run the app on different platforms
  5. Make a small modification and see it update
Test Your Knowledge - Take Quiz