Introducing .NET Multi-platform App UI

Scott Hunter [MSFT]

You can build anything with .NET. It’s one of the main reasons millions of developers choose .NET as the platform for their careers, and companies invest for their businesses. With .NET 5 we begin our journey of unifying the .NET platform, bringing .NET Core and Mono/Xamarin together in one base class library (BCL) and toolchain (SDK).

As we consider what building device applications will look like in a unified .NET, we see many devices across multiple platforms used, from Android and iOS to Windows and macOS. To address this need we are excited to announce a new first-class UI framework for doing just that: .NET Multi-platform App UI, affectionately called .NET MAUI.

Let us introduce you to what .NET MAUI is, the single project developer experience, modern development patterns, and a look at the journey ahead.

MAUI overview

What is .NET MAUI

.NET MAUI is an evolution of the increasingly popular Xamarin.Forms toolkit that turns 6 years old this month. For years companies such as UPS, Ernst & Young, and Delta have been leveraging the mobile expertise of Xamarin atop .NET to power their businesses; some since the very beginning. It has also been very successful in helping small businesses maximize their development investment sharing upwards of 95% of their code, and beating their competitors to market. .NET MAUI extends this success on mobile to embrace the desktop making it the best way to build multi-platform applications across both, especially our new devices such as the new Surface Duo.

.NET MAUI simplifies the choices for .NET developers, providing a single stack that supports all modern workloads: Android, iOS, macOS, and Windows. The native features of each platform and UI control are within reach in a simple, cross-platform API for you to deliver no-compromise user experiences while sharing even more code than before.

Single Project Developer Experience

.NET MAUI is built with developer productivity in mind, including the project system and cross-platform tooling that developers need. .NET MAUI simplifies the project structure into a single project to target multiple platforms. This means you can easily deploy to any target that you wish including your desktop, emulators, simulators, or physical devices with a single click. With built-in cross-platform resources you will be able to add any images, fonts, or translation files into the single project, and .NET MAUI will automatically setup native hooks so you can just code. Finally, you will always have access the native underlying operating system APIs and it will be easier than ever with new platform specific integrations. Under platforms you can add source code files for a specific operating system and access the native APIs. With .NET MAUI everything is in one place where you need it to keep you productive.

.NET MAUI Single Project

This delivers:

  • One project targeting multiple platforms and devices
  • One location to manage resources such as fonts and images
  • Multi-targeting to organize your platform-specific code

You master one way to build client apps, the .NET MAUI way, and all platforms are within your reach. Today, Scott Hanselman and I will demo it in action at Build, The Journey to One .NET.

Modern App Patterns

Part of the vision for one .NET is providing developer choice in the areas of personal preferences so you can be most productive using .NET. This manifests in which IDE you use whether Visual Studio 2019, Visual Studio for Mac, or even Visual Studio Code. .NET MAUI will be available in all of those, and support both the existing MVVM and XAML patterns as well as future capabilities like Model-View-Update (MVU) with C#, or even Blazor.

MVVM

Model-View-ViewModel (MVVM) and XAML, the predominant pattern and practice among .NET developers for decades now, are first-class features in .NET MAUI. This will continue to grow and evolve to help make you productive building and maintaining production apps.

<StackLayout>
    <Label Text="Welcome to .NET MAUI!" />
    <Button Text="{Binding Text}" 
            Command="{Binding ClickCommand}" />
</StackLayout>
public Command ClickCommand { get; }

public string Text { get; set; } = "Click me";

int count = 0;

void ExecuteClickCommand ()
{
    count++;
    Text = $"You clicked {count} times.";
}

MVU

In addition, we are enabling developers to write fluent C# UI and implement the increasingly popular Model-View-Update (MVU) pattern. MVU promotes a one-way flow of data and state management, as well as a code-first development experience that rapidly updates the UI by applying only the changes necessary. For more information about MVU as a pattern, check out this Elm Programming guide and this blog from Thomas Bandt.

Below is a basic counter example in the MVU style written in .NET MAUI.

readonly State<int> count = 0;

[Body]
View body() => new StackLayout
{
    new Label("Welcome to .NET MAUI!"),
    new Button(
        () => $"You clicked {count} times.",
        () => count.Value ++)
    )
};

This pattern is ideally suited for hot reload as you can see below with added styling, gradients, and fonts with instant hot reload from C#.

MAUI model-view-update

Both MVVM and MVU deliver the same native applications, performance, and platform fidelity. Developers will be able to choose which style best suits their preference and use case.

Transitioning from Xamarin.Forms to .NET MAUI

Xamarin.Forms developers will hit the ground running with new projects in .NET MAUI, using all the same controls and APIs they have grown to know and love. As we get closer to the .NET MAUI launch, In order to help developers make a smooth transition of existing apps to .NET MAUI we intend to provide try-convert support and migration guides similar to what we have today for migrating to .NET Core.

The .NET MAUI Timeline

We will begin shipping .NET MAUI previews later this year, and target general availability with .NET 6 in November of 2021. .NET MAUI will ship on the same 6 week cadence that Xamarin.Forms has been on. We have published the .NET MAUI roadmap on GitHub and invite you to join us there today!

What’s Next for Xamarin and Xamarin.Forms

As part of our .NET unification, Xamarin.iOS and Xamarin.Android will become part of .NET 6 as .NET for iOS and .NET for Android. Because these bindings are projections of the SDKs shipped from Apple and Google, nothing changes there, however build tooling, target framework monikers, and runtime framework monikers will be updated to match all other .NET 6 workloads. Our commitment to keeping .NET developers up-to-date with the latest mobile SDKs is foundational to .NET MAUI and remains firm. When .NET 6 ships, we expect to ship a final release of Xamarin SDKs in their current form that will be serviced for a year. All modern work will at that time shift to .NET 6.

Xamarin.Forms will ship a new major version later this year, and continue to ship minor and service releases every 6 weeks through .NET 6 GA in November 2021. The final release of Xamarin.Forms will be serviced for a year after shipping, and all modern work will shift to .NET MAUI.

Get Involved Today

Join us on this journey to .NET MAUI at our brand new repository dotnet/maui. Be sure to star and watch to get notifications, then join in the discussion of proposals describing how we want to evolve the code base. This is the very beginning of a long journey welding Xamarin and Xamarin.Forms directly into the heart of .NET, and we are excited to do this in the open with you.

165 comments

Discussion is closed. Login to edit/delete existing comments.

  • Jeff Jones 0

    Please say there will be a UI designer. MS could provide a designer for WinForms going back 30+years to VB, then VS.NET. That one was not provided for XF is an embarrassment. The productivity gains with a UI designer are immense. Please don’t set RAD IDEs back 30 years with no UI designer.

    • David OrtinauMicrosoft employee 0

      Hi Jeff,

      Our productivity work is invested in Hot Reload for XAML and C#, and Hot Restart for deeper changing of resources and IDE to device connections. These rate much higher in terms of developer satisfaction and productivity. I hope you’ll give them a try.

  • Chris Hills 0

    MAUI is the name of a pre-existing UI framework created by the KDE project. Please see https://mauikit.org/.

    • Matt 0

      Yep, that’s what I found first when I searched for info about the MS version of Maui.

  • Charles Roddie 0

    This is great because Xamarin.Forms badly needs a fresh start. It has became unmanageable because of 1. adding an abundance of features without stabilizing existing ones, 2. an extremely complex architecture that makes it very hard to contribute/merge fixes.

    In order to improve on Xamarin.Forms this needs to be subtractive. The current Xamarin.Forms organization will always decide to increase size and complexity at the cost of maintainability, and keep delivering buggy releases as a result. This strategy has made it a maintenance nightmare. This needs to have a higher-level review so that MPAU can be brought to the standard expected of a core .Net repository. Each feature needs to be analyzed to weigh up its benefits against its maintenance implications.

    I would suggest some principles:
    1. Be open, on a case by case basis, to using SkiaSharp renderers rather than platform-specific implementations, to dramatically reduce the amount of code needed to be maintained, and to improve consistency across platforms.
    2. Separate objects and markup. The objects can be defined in a core repo, and markup languages that describe them in others. This reduces the potential for bugs in the core repo as objects are more type-safe. It avoids the craziness that there are 2 markup languages in XF (xaml and css)! Users should not need to work with the markup layer in order to fix bugs in the core layer.
    3. Things that are not MPAU-specific should be removed from MPAU. For example navigation does not need to be in MPAU.
    4. Have type-safety as a priority. That may mean altering the binding framework to one not involving strings and untyped objects.

    We use Xamarin.Forms and the fight against bugs is a huge problem. The amount of effort needed to make a bugfix in the repo is huge so we often gave up. Instead bugfixes are currently made inside user projects (as “renderers”) instead of shared with the community.

    • Luis Avila 0

      This, this. oh my god this!!!

    • Maximo Piva 0

      This guy!!!!

      1) Or DirectX porting…

      5) Increase the quality of tooling, please.

    • Emil Alipiev 0

      Seriously skiasharp everywhere? You want flutter with c#? Why would we need another flutter when there is a native platform alternative. If you want to do skia everything go do flutter. Dart is not so different than c#

    • Michal Dobrodenka 0

      We were waiting and evaluating Xamarin.Forms several times, last time in 2017. Xamarin.Forms was a little overbloated, buggy and slow (adding 1 sec to Android start). And also missing features – in 2017 there was no CollectionView (is it on all platofrms now?) In the end we decided to make own multiplatform framework which position controls natively – UICollectionView, VirtualizingPanel, RecyclerView and render via SkiaSharp. Right now we target Android, iOS and WPF and we are happy with this solution. We made our “flutter” 🙂 (Together with parametrized vector icons via PaintCode/SkiaSharp it makes a very nice UI development experience)

  • Gauthier M. 0

    Is it supposed to replace WPF and UWP ?

    • David OrtinauMicrosoft employee 0

      Gauthier,

      Not at all, .NET MAUI is an abstraction across native platforms. As you can see in Xamarin.Forms, both UWP and WPF exist as targets from a single Xamarin.Forms app.

  • Andrew Leader 0

    This seems really great, especially the “one project” part! I might even consider re-writing my Xamarin native Android, iOS, and UWP apps to this when it comes out.

    However, I’m not sure about MVU… React’s virtual DOM seems like a much more brilliant idea. In MVU, what if you need to sometimes include or not include a UI component, or need some more complicated logic within constructing the view? For example, if you have a StackPanel that sometimes needs to have 5 items and other times needs to have only 1 item (and they’re different items)? In React, you’d just say “if true, render this, else render that”… but I don’t see how you’d be able to do the same in MVU?

    Or actually is it using a virtual “DOM”? I was looking at Clancey’s implementation of Comet, seems like it does. Seems like you could mix in more complicated code?

    • Alex Badescu 0

      i’d very much want to see that.

    • David OrtinauMicrosoft employee 0

      Hey Andrew,

      Would love your feedback about single project on dotnet/maui!

      Correct, we are taking our learnings from the Comet experiment and bringing the best pieces into .NET MAUI. I hope you’ll follow us along this journey and share your thoughts.

  • Yaroslav (DevExpress) 0

    Can you define the underlying text/graphics rendering engine for each support platform? For example, it going to be GDI/GDI+/DirectWrite/Skia/Pango on Windows?

    • Cory Crooks 0

      Yeah, and whats the story for WASM? WebGL? Canvas? “Uh, no its not going to that”?

      • David Cuccia 0

        Interested in this, too. And WebGPU.

    • David OrtinauMicrosoft employee 0

      Yaroslav,

      The default rendering is handled by the native platform default. .NET MAUI doesn’t provide a separate rendering, though you can introduce something like SkiaSharp as an alternative.

  • Alex Badescu 0

    How does Reunion fit in with MAUI?

    Is it intended that they will merge in .NET 7+?

  • Matthew Heimlich 0

    Linux support? I don’t see it mentioned by name and it’s a big missing piece of the puzzle for my team.

    • Max Mustermueller 0

      You don’t see it mentioned because it’s basically just Xamarin renamed (simplified). Xamarin does not support Linux (officially and under active development). Therefore, no, MAUI won’t have Linux support. Now you ask yourself what’s the big thing then, when you can also just use Xamarin now?! Good question, nobody knows. It may have a better integration into VS or some small differences but it’s neither a new thing nor an evolution.

    • David OrtinauMicrosoft employee 0

      If you’re interested in contributing or collaborating on the existing GTK# implementation, I invite you to join the conversation on GitHub.

  • Loki Sharp 0

    What about Linux?

    • David OrtinauMicrosoft employee 0

      As I mentioned above just now, if you’re interested in contributing or collaborating on the existing GTK# implementation, I invite you to join the conversation on GitHub.

  • Andrew Beeman 0

    Really? Xamarin Stack Layout? Come one man. There’s zilch Xam devs solely for that reason. EF/LINQ Lambda are god like for development and then we get trashed on with Stack Layout. The amount of Xam devs alone should tell you that you’re doing it wrong.

    • David OrtinauMicrosoft employee 0

      Hey Andrew,

      We are open to discussing improvements to layout. Come join us on dotnet/maui and share your experiences and thoughts with us.

Feedback usabilla icon