.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 can run on Android, iOS, macOS, and Windows from a single shared code-base.
Who .NET MAUI is for
.NET MAUI is for developers who want to:
- Write cross-platform apps in XAML and C#, from a single shared code-base in Visual Studio.
- Share UI layout and design across platforms.
- Share code, tests, and business logic across platforms.
.NET MAUI stands for Multi-platform App UI, and it is a framework for building native mobile and desktop applications with a single shared code base.
As the successor to Xamarin Forms, .NET MAUI is the next major step in the evolution of Microsoft’s cross-platform development offering, allowing one to target Android, iOS, macOS, and Windows at the same time, thereby achieving even greater re-usability and development efficiency.
What .NET MAUI provides
.NET MAUI provides a collection of controls that can be used to display data, initiate actions, indicate activity, display collections, pick data, and more. In addition to a collection of controls, .NET MAUI also provides:
- An elaborate layout engine for designing pages.
- Multiple page types for creating rich navigation types, like drawers.
- Support for data-binding, for more elegant and maintainable development patterns.
- The ability to customize handlers to enhance the way in which UI elements are presented.
- Cross-platform APIs for accessing native device features. These APIs enable apps to access device features such as the GPS, the accelerometer, and battery and network states. For more information, see Cross-platform APIs for device features.
- Cross-platform graphics functionality, that provides a drawing canvas that supports drawing and painting shapes and images, compositing operations, and graphical object transforms.
- A single project system that uses multi-targeting to target Android, iOS, macOS, and Windows. For more information, see .NET MAUI Single project.
- .NET hot reload, so that you can modify both your XAML and your managed source code while the app is running, then observe the result of your modifications without rebuilding the app. For more information, see .NET hot reload.
Cross-platform APIs for device features
.NET MAUI provides cross-platform APIs for native device features. Examples of functionality provided by .NET MAUI for accessing device features includes:
- Access to sensors, such as the accelerometer, compass, and gyroscope on devices.
- Ability to check the device's network connectivity state, and detect changes.
- Provide information about the device the app is running on.
- Copy and paste text to the system clipboard, between apps.
- Pick single or multiple files from the device.
- Store data securely as key/value pairs.
- Utilize built-in text-to-speech engines to read text from the device.
- Initiate browser-based authentication flows that listen for a callback to a specific app registered URL.
.NET MAUI single project takes the platform-specific development experiences you typically encounter while developing apps and abstracts them into a single shared project that can target Android, iOS, macOS, and Windows.
.NET MAUI single project provides a simplified and consistent cross-platform development experience, regardless of the platforms being targeted. .NET MAUI single project provides the following features:
- A single shared project that can target Android, iOS, macOS, and Windows.
- A simplified debug target selection for running your .NET MAUI apps.
- Shared resource files within the single project.
- A single app manifest that specifies the app title, id, and version.
- Access to platform-specific APIs and tools when required.
- A single cross-platform app entry point.
.NET MAUI single project is enabled using multi-targeting and the use of SDK-style projects in .NET 6. For more information about .NET MAUI single project, see .NET MAUI single project.
.NET MAUI includes support for .NET hot reload, which enables you to modify your managed source code while the app is running, without the need to manually pause or hit a breakpoint. Then, your code edits can be applied to your running app without recompilation.
.NET MAUI includes support for XAML hot reload, which enables you to save your XAML files and see the changes reflected in your running app without recompilation. In addition, your navigation state and data will be maintained, enabling you to quickly iterate on your UI without losing your place in the app.
A .NET MAUI app project contains a Platforms folder, with each child folder representing a platform that .NET MAUI can target:
Multi-targeting can also be combined with conditional compilation so that code is targeted to specific platforms:
#if ANDROID handler.NativeView.SetBackgroundColor(Colors.Red.ToNative()); #elif IOS handler.NativeView.BackgroundColor = Colors.Red.ToNative(); handler.NativeView.BorderStyle = UIKit.UITextBorderStyle.Line; #elif WINDOWS handler.NativeView.Background = Colors.Red.ToNative(); #endif
Supported platforms for .NET MAUI apps
.NET Multi-platform App UI (.NET MAUI) apps can be written for the following platforms:
- Android 5.0 (API 21) or higher.
- iOS 11 or higher, using the latest release of Xcode.
- macOS 10.15 or higher, using Mac Catalyst.
- Windows 11 and Windows 10 version 1809 or higher, using Windows UI Library (WinUI) 3.
.NET MAUI Blazor apps have the following additional platform requirements:
- Android 7.0 (API 24) or higher is required
- iOS 14 or higher is required.
- macOS 11 or higher, using Mac Catalyst.
Should you use .NET MAUI?
Whether you should be using .NET MAUI depends on your specific use case, and a few scenarios are discussed below.
You are already working with Xamarin Forms
Since MAUI is the successor to Xamarin Forms, offering many enhancements as discussed above, it makes perfect sense to upgrade your app to MAUI, the only question being around the timing of the upgrade.
You are planning to build a mobile app and are already invested in the .NET stack
If your company already has software built on .NET, whether for desktop or web, using MAUI for mobile app development would be a natural choice to:
- re-use common libraries and business logic,
- leverage the .NET knowledge within the team, and
- share UI code, either for an existing WinUI desktop application or by wrapping an existing Blazor-based web app into a MAUI container.
You are planning to build a cross-platform native mobile app but have not decided which technology to use
The three main players in the mobile cross-platform space for native apps are MAUI/Xamarin Forms, Flutter, and React Native.
One of the advantages that Flutter and Reactive Native had over Xamarin Forms was their fast inner-loop development experience allowing code changes to be visible immediately via a hot reload mechanism. .NET MAUI now provides full hot reload support for C# files as well, bringing it on par with Flutter and React Native.
You are planning to build a native cross-platform desktop app
If you only need to target Windows and macOS (via Mac Catalyst) with a cross-platform desktop app, then using MAUI can be a great choice because unlike many of the available cross-platform desktop frameworks, MAUI produces fully native apps, that have greater performance and OS integration compared to web UIs that are just hosted in a native container.
Currently, MAUI supports writing applications that run on Android 5+, iOS 10+, macOS 10.15+, Windows 10 version 1809+, or Windows 11. MAUI application project is a single . NET project.
.NET MAUI’s key advantage is the mature, sophisticated, and widely available .NET ecosystem that provides great interoperability and code re-usability, high quality and well-supported libraries, powerful tools and IDEs, and a large active community of developers. Depending on what your business needs are, choosing the .NET stack is often a preferred option, especially for enterprise development, because of the stability, open-source, re-usability, support and longevity that it offers.
Our experience has been great and our developers absolutely love working with .NET MAUI. We would be happy to share our experiences with you, having now completed the development of a number of commercial, cross-platform applications using .NET MAUI targeting: IOS | Android | Windows. We are actively developing a number of Blazor Hybrid (.NET MAUI Blazor applications) from our Bournemouth based development agency in the United Kingdom.