Back to Maui

.NET Multi-platform App UI (.NET MAUI)

src/Controls/src/NuGet/README.md

10.0.8011.6 KB
Original Source

.NET Multi-platform App UI (.NET MAUI)

.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. Using .NET MAUI, you can develop apps that run on Android, iOS, iPadOS, macOS, and Windows from a single shared codebase.

✨ What is .NET MAUI?

The Microsoft.Maui.Controls package provides the UI controls and XAML infrastructure for building beautiful, native cross-platform applications. It includes:

  • 40+ UI controls - Buttons, labels, entries, pickers, lists, grids, and more
  • XAML support - Design your UI with declarative markup
  • Layout system - Flexible layouts including Grid, StackLayout, FlexLayout, and AbsoluteLayout
  • Navigation - Shell navigation, NavigationPage, TabbedPage, FlyoutPage
  • Data binding - Two-way data binding with MVVM support
  • Styling and theming - Application-wide styles, dynamic resources, and light/dark theme support
  • Platform integration - Access platform-specific features seamlessly
  • Hot Reload - See UI changes instantly during development

🚀 Supported Platforms

.NET MAUI applications run on the following platforms:

PlatformMinimum Version
AndroidAPI 21 (Android 5.0)
iOSiOS 13.0+
iPadOSiPadOS 13.0+
macOSmacOS 12.0+ (via Mac Catalyst)
WindowsWindows 11, Windows 10 (Version 1809+) using Windows UI Library (WinUI)

📦 Getting Started

Prerequisites

  • .NET 10 SDK (or .NET 9 for previous versions)
  • Platform-specific tools:
    • Android: Android SDK (installed via Visual Studio or Android Studio)
    • iOS/macOS: Xcode (Mac required)
    • Windows: Windows App SDK

Installation

Install the .NET MAUI workload:

bash
dotnet workload install maui

Create a New Project

Create a new .NET MAUI app using the CLI:

bash
dotnet new maui -n MyMauiApp
cd MyMauiApp

Or create with sample content including Community Toolkit and Syncfusion Toolkit:

bash
dotnet new maui -n MyMauiApp -sc

Run Your App

Run on Android:

bash
dotnet build -t:Run -f net10.0-android

Run on iOS (Mac only):

bash
dotnet build -t:Run -f net10.0-ios

Run on Mac Catalyst (Mac only):

bash
dotnet build -t:Run -f net10.0-maccatalyst

Run on Windows:

bash
dotnet build -t:Run -f net10.0-windows10.0.19041.0

💡 Quick Start Example

Here's a simple .NET MAUI page to get you started:

xml
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <VerticalStackLayout Padding="30" Spacing="25">
        <Label Text="Hello, .NET MAUI!"
               FontSize="32"
               HorizontalOptions="Center" />
        <Button Text="Click Me" 
                Clicked="OnButtonClicked" />
        <Label x:Name="CounterLabel"
               Text="Button not clicked yet"
               HorizontalOptions="Center" />
    </VerticalStackLayout>
</ContentPage>

Learn more:

🎯 Key Features

MVVM and Data Binding

.NET MAUI fully supports the Model-View-ViewModel (MVVM) pattern with powerful data binding:

xml
<Label Text="{Binding UserName}" />
<Entry Text="{Binding Email, Mode=TwoWay}" />

Learn more:

XAML Enhancements

.NET MAUI includes powerful XAML features for cleaner, more efficient code:

xml
<!-- Simplified property syntax -->
<Button Text="Click Me" Clicked="OnClicked" />

<!-- Markup extensions -->
<Label Text="{Binding Title}" 
       TextColor="{StaticResource PrimaryColor}" />

Learn more:

Shell Navigation

Shell provides a structured, performant navigation experience:

xml
<Shell>
    <TabBar>
        <ShellContent Title="Home" 
                      Icon="home.png"
                      ContentTemplate="{DataTemplate local:HomePage}" />
        <ShellContent Title="Settings" 
                      Icon="settings.png"
                      ContentTemplate="{DataTemplate local:SettingsPage}" />
    </TabBar>
</Shell>

Learn more:

Collections and Lists

Display lists and collections with CollectionView:

xml
<CollectionView ItemsSource="{Binding Items}">
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <Grid Padding="10">
                <Label Text="{Binding Name}" 
                       FontSize="18" />
            </Grid>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

Learn more:

Responsive Layouts

Build adaptive UIs that work across different screen sizes:

xml
<Grid RowDefinitions="Auto,*" 
      ColumnDefinitions="*,*">
    <Label Grid.ColumnSpan="2" 
           Text="Header" />
    <BoxView Grid.Row="1" 
             Grid.Column="0" 
             Color="Blue" />
    <BoxView Grid.Row="1" 
             Grid.Column="1" 
             Color="Green" />
</Grid>

Learn more:

📚 Documentation and Resources

Official Documentation

Learning Resources

Community Resources

💬 Feedback and Support

We welcome your feedback and contributions!

Getting Help

Reporting Issues

Community

🤝 Contributing

We encourage contributions from the community! .NET MAUI is an open-source project.

.NET MAUI consists of several packages that work together:

PackageDescription
Microsoft.Maui.ControlsCore UI controls and XAML (this package)
Microsoft.Maui.CorePlatform abstractions and handlers
Microsoft.Maui.EssentialsCross-platform APIs (merged into Core)
Microsoft.Maui.GraphicsCross-platform graphics library
CommunityToolkit.MauiCommunity-built controls and helpers

📄 License

.NET MAUI is licensed under the MIT License.

🎉 Acknowledgements

.NET MAUI is the evolution of Xamarin.Forms, building on years of mobile and cross-platform development experience. We thank the community for their continued support and contributions.


Get Started with .NET MAUI | Documentation | Samples | GitHub