What's the Difference Between MAUI and Uno, and What Do They Mean for .NET Developers?
Tags: dotnet, webdev, devops, webassembly
Published: 2021-05-26 14:17:30


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](https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-1/), 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 and explore the differences between MAUI and Uno.


### What is Xamarin?

For those unfamiliar with [Xamarin](https://dotnet.microsoft.com/apps/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 behavior.

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](https://docs.microsoft.com/en-us/xamarin/get-started/quickstarts/app?pivots=windows) 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](https://blog.jetbrains.com/dotnet/2020/06/16/developer-ecosystem-2020-key-trends-c/#:~:text=NET%20Core%20is%20gaining%20popularity,We%20suspect%20that%20.&text=Web%20developers%20who%20create%20ASP,world%20for%20some%20time%20now) 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](https://platform.uno/), 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](https://docs.microsoft.com/en-us/windows/communitytoolkit/), which is a collection of helper functions, custom controls, and app services.
3. .NET MAUI will most likely look to the [Xamarin Community Toolkit](https://github.com/xamarin/XamarinCommunityToolkit) for a collection of established controls, helper functions, and services.

Traditionally, [Model-View-ViewModel (MVVM)](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/enterprise-application-patterns/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)](https://thomasbandt.com/model-view-update) 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](https://platform.uno/docs/articles/get-started.html) guide and install the missing dependencies, including the [Uno Platform Solution Template](https://marketplace.visualstudio.com/items?itemName=nventivecorp.uno-platform-addin) 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](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/1-shared-project.png)

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

```
<StackPanel>  
  <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"  
     AcceptsReturn="True"  
     Height="100"  
     Margin="10,0"  
     PlaceholderText="Enter Text Here" />  
</StackPanel>
```

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](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/2-web-assembly-apps.png) 

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](https://docs.microsoft.com/en-us/windows/uwp/app-resources/localize-strings-ui-manifest). 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](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/3-unoapp-shared.png)  

![uno app shared](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/4-unoapp-shared-2.png) 

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

![uno app](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/5-uno-app.png)

For more, explore the tutorial that demonstrates [basic model binding](https://platform.uno/docs/articles/getting-started-tutorial-2.html).

Even more impressive is that there are [fully operational apps](https://platform.uno/code-samples/) to showcase the Uno Platform. An Azure DevOps app, for example, organizes and tracks work items and bugs, fully shipped with a [demo site](https://uado.platform.uno) and [git repo](https://github.com/unoplatform/uado).

### 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](https://devblogs.microsoft.com/xamarin/the-new-net-multi-platform-app-ui-maui/). 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:

```
<Label  
  BindingContext="{x:Reference slider}"  
  Text="{Binding Value}" FontSize="Title" Padding="30,10,30,10"/>  
<Slider x:Name="slider" Minimum="0" Maximum="360"/>  
<Label  
  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](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/6-text-input.png)

Similarly, a Xamarin.Forms app can use .resx files to [manage String Resources](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/text?pivots=windows#create-resx-files) 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](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/7-xamarin-forms-sample.png) 

![xamarin forms sample](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/8-xamarin-forms-sample-2.png)

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

![maui app demo](https://global-cdn.grapecity.com/blogs/componentone/20210413-whats-the-difference-between-maui-and-uno/9-maui-demo.png)

### 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](https://platform.uno/docs/articles/howto-use-uno-in-xamarin-forms.html), and you can run [Xamarin.Forms Apps in a browser using Uno](https://platform.uno/xamarin-forms/). 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](https://www.grapecity.com/componentone) UI control toolkit, including charts, calendars, ribbons, and much more.