Skip to main content Skip to footer

What's the Difference Between MAUI and Uno, and What Do They Mean for .NET Developers?

In the world of software, simplicity is the key to building successful, high-quality applications. Yet, the more we desire simplicity, the more elusive it becomes.

The focus on user experience has made the digital world accessible. Software specification used to involve whether it runs on Windows, Linux, or a Mac. These days, we ask questions like what browsers will an application run in and does it support mobile platforms such as Android and iOS.

When we build the same application for several platforms, we encounter challenges that seem trivial for one platform, but become huge obstacles. These are issues such as: How do you manage translations? How do you maintain colors? What about image assets?

While it has been a difficult journey, we have evolved as an industry. We learned to separate presentation from logic, we developed new techniques, and we built new tools to simplify the developer process.

Today, we have Xamarin.Forms to build mobile applications. As part of .NET 6, Microsoft is taking Xamarin.Forms to the next level in the Multi-platform App UI (MAUI) framework, extending its capabilities to desktop applications.

The rise of Xamarin also led to other multi-platform technologies such as the Uno Platform, which enables developers to truly write once, run everywhere. This article will look deeper into multi-platform technologies. Topics covered include:

What is Xamarin?

For those unfamiliar with Xamarin, it is a platform to write native mobile applications for Android, iOS, and universal apps in the .NET world. Xamarin APIs faithfully reflect each application platform's signatures, so writing code for Xamarin is as close to native as it gets in the .NET world.

Typically, a Xamarin solution consists of one project for each platform to support (Android, iOS, universal), each with their distinct build settings. You write the application in .NET, and through the magic of the compiler, your .NET code becomes an application that is understood by and executed natively on the respective platform.

This means, with some careful architecting, you can share your code with each platform you support. This reduces not only your effort to deliver the application on different platforms, but also the risk of inconsistencies in behaviour.

Microsoft took this a step further and introduced Xamarin.Forms. With Xamarin.Forms, a developer can even write the user interface (UI) code in a shared library, through code in XAML files.

Visit the Microsoft Create a Xamarin.Forms application quickstart for an example of a Xamarin.Forms view (see step 10).

You only need to create this form once in the shared library, then each platform creates its corresponding control.

Microsoft is bringing Xamarin into the .NET Core family. In the last few years, .NET Core has been an enormous success, with 68 percent of .NET Developers already using .NET Core regularly. Microsoft also indicated that .NET Core is the main implementation going forward by dropping “Core” in its name. The next release of .NET Core is .NET 6, which includes the MAUI framework.

What is .NET MAUI?

.NET MAUI is the next step in Xamarin.Forms, the natural progression unifying the mobile and desktop development experience in a single project and extending its success on mobile to desktop applications. The biggest differences between .NET MAUI and Xamarin.Forms are:

  1. All platforms can be managed in a single project
  2. One location to manage all assets
  3. Multi-targeting to organize platform-specific code
  4. Out-of-box support for the Model View Update (MVU) pattern
  5. Support for Blazor

With Xamarin in the .NET Core family, developers benefit from building applications with the dotnet CLI means a consistent build process. You can use the same command line tool to build both the client application and backend services.

What is the Uno Platform?

The Uno Platform, developed by nventive in 2013 and open-sourced in 2018, enables you to build cross-platform applications in C#. Similar to Xamarin.Forms, Uno also aims for the goal of "write once, run everywhere" using APIs mirroring those provided by Universal Windows Platform (UWP) and WinUI.

While the platform uses the Xamarin Native (not Forms) stack for mobile and macOS development, it extends its reach to the web through WebAssembly (Wasm) and Linux through Skia. This means any updates to Xamarin (through MAUI and .NET) are carried over to Uno.

You might see Uno as an alternate path to the evolution of Xamarin Native.

How Does .NET MAUI Differ From Uno?

While .NET MAUI is the next step up in Xamarin.Forms, Uno has taken its own approach to deliver more of what .NET MAUI has on its roadmap.

The first and most obvious difference is that the Uno platform enables developers to build for WebAssembly and Linux desktop, while .NET MAUI currently does not support Wasm or Linux.

The platforms also differ in terms of look and feel. .NET MAUI focuses on providing a native experience, which means a list (for example) looks different on an Android versus an iOS device. Uno Platform, on the other hand, provides the same look and feel on all platforms. This means radio buttons on iOS out of the box—no need to write custom controls for iOS. However, Uno does provide hooks to build different-looking controls if needed, much like .NET MAUI.

Developer Experience

Since both .NET MAUI and the Uno Platform are built for the .NET family, the developer experience should be similar, right?

On the surface, they do seem to be exactly the same: .NET MAUI is the next version of Xamarin.Forms and Uno is just an abstraction of Xamarin.

However, the fact that Uno aligns itself with UWP makes a big difference:

  1. .NET MAUI and Uno Platform use different flavors of XAML.
  2. Uno provides an official port of the Microsoft Community Toolkit, which is a collection of helper functions, custom controls, and app services.
  3. .NET MAUI will most likely look to the Xamarin Community Toolkit for a collection of established controls, helper functions, and services.

Traditionally, Model-View-ViewModel (MVVM) has been the pattern of choice for both Xamarin.Forms and the Uno Platform. .NET MAUI comes with out-of-box support for the Model View Update (MVU) pattern, which might be interesting for some developers.

Creating an App Using Uno Platform

Let’s walk through an example using the Uno Platform. To get started:

  1. Follow the Getting Started on Visual Studio guide and install the missing dependencies, including the Uno Platform Solution Template extension.
  2. Create a new project in Visual Studio.
  3. Choose the Uno Platform template.

This creates a solution that looks like the example below. It creates one project for each of the supported platforms. Most of the code and assets live under the Shared project.

uno shared project

As a demo, go into MainPage.xaml and add the following:

  <TextBlock Text="{Binding Value, ElementName=slider}" Margin="20" FontSize="30" />  
  <Slider x:Name="slider"/>  
  <TextBlock Text="{Binding Text, ElementName=textbox}" Margin="20" FontSize="30" />  
  <TextBox x:Name="textbox"  
     PlaceholderText="Enter Text Here" />  

The XAML markup should look familiar to those who have used Windows Presentation Foundation (WPF) in the past. A stack panel surrounds a slider and text box, with labels that are bound to the values of these two inputs.

This is what the WebAssembly application looks like in a browser:

web assembly apps

Nothing too exciting here — the exciting part is we now have a working app that displays the value of a slider on every platform.

Uno Platform manages string resources as a UWP application. Create the Resources.resw file under the language code and you can reference them in XAML like so:

<TextBlock x:Uid="Demo"  Margin="20" FontSize="30" />

uno app shared

uno app shared

And with that, here’s our app with the title “Uno App” on top.

uno app

For more, explore the tutorial that demonstrates basic model binding.

Even more impressive is that there are fully operational apps to showcase the Uno Platform. An Azure DevOps app, for example, organizes and tracks work items and bugs, fully shipped with a demo site and git repo.

Sample MAUI (Xamarin.Forms) App

MAUI samples are not yet ready, but a .NET MAUI app should look similar to a Xamarin.Forms app.

Microsoft recommends anyone who wishes to use .NET MAUI to continue using Xamarin.Forms. They will provide a migration path when everything is ready.

We can achieve the same functionality in Xamarin.Forms as .NET MAUI using the following XAML markup:

  BindingContext="{x:Reference slider}"  
  Text="{Binding Value}" FontSize="Title" Padding="30,10,30,10"/>  
<Slider x:Name="slider" Minimum="0" Maximum="360"/>  
  Text="{Binding Text}"  
  BindingContext="{x:Reference input}"  
<Entry x:Name="input" />

Notice, in this example, TextBlocks are now Labels and the TextBox is mapped to an Entry. This is due to Xamarin.Forms adapting its API to UWP.

text input

Similarly, a Xamarin.Forms app can use .resx files to manage String Resources for all languages, but we expect .NET MAUI to provide a smoother experience.

For our example, we added an AppResources.resx to the project.

xamarin forms sample

xamarin forms sample

Unlike the Uno sample, the requesting property can access Title directly.

maui app demo

What Does This Mean for .NET Developers?

These are exciting times. Is it finally possible to write code once and have it run on every platform? Countless developers have scrapped projects after deciding their time was better spent building on a different platform. These multi-platform tools are a huge time-saver, enabling developers to spend time creating great new features instead of reworking the same code multiple times.

New platform support no longer means more work. It means opportunity.

With the anticipated release of .NET MAUI and platforms like Uno, developers can truly write code once and run everywhere.

For years, developers struggled with the thought of multi-platform applications. But, if we looked just a little bit harder, we could have seen that it was already a reality in the form of frameworks such as the Uno Platform, with capabilities to write code once, and run on Android, iOS, Windows, macOS, Linux, and browsers.

On the other hand, mark your calendars for November 2021, the anticipated release date of .NET 6. Microsoft is stepping up their unifying effort, taking Xamarin.Forms to its next level with .NET MAUI to extend cross-platform capabilities to desktop applications. This is great news even if you decide to forego .NET MAUI and choose Uno Platform, because Uno Platform is built on .NET. It will automatically inherit all performance gains introduced in .NET 6.

Here is the best part: you can use Uno Platform Controls in Xamarin.Forms, and you can run Xamarin.Forms Apps in a browser using Uno. Although .NET MAUI isn’t out yet, Microsoft hasn’t given us much of a reason to doubt this will continue to work.

The future is bright! What are you waiting for? Get started with multi-platform development now to keep up with this cutting-edge technology. And, when you use Uno Platform or Xamarin.Forms, speed up your development time even more with GrapeCity’s ComponentOne UI control toolkit, including charts, calendars, ribbons, and much more.

Ready to check it out? Download ComponentOne Today!

comments powered by Disqus