Small Bytes: .NET MAUI Desktop Apps (Premium)

.NET MAUI is the successor to Xamarin Forms and it obviously isn’t the first cross-platform framework to target both mobile and desktop. But it’s positioned similarly to competitors like Flutter or React Native. That is, no developer will ever use .NET MAUI to create a new app that only runs on Windows. Instead, MAUI is best used to tailor a new or existing mobile app so that it works better and feels more natural on Windows (and Mac).

This distinction is important: Microsoft hasn’t created a true desktop-class application framework since Windows Presentation Foundation (WPF), which arrived in late 2006 with Windows Vista. Instead, subsequent efforts like Metro, Universal Windows Platform (UWP), and the Windows App SDK (“Project Reunion”) are mobile app frameworks. (Yes, I know: Microsoft describes the latter as a desktop framework. That’s not accurate.) Anyone targeting the desktop today will do so via existing codebases or will create a new app using web or cross-platform frameworks of some kind.

Building even a relatively simple new productivity app, like a new version of my .NETpad app, with .NET MAUI is untenable, at least for now, because this framework doesn’t provide the rich controls needed for such apps. But from what I can tell, .NET MAUI is the simplest way to create a new app using WinUI 3, the modern Microsoft UI framework that’s based on the Fluent Design System. That alone makes it interesting: creating WinUI 3-based apps in the Windows App SDK, or adding WinUI 3 to existing codebases is, in my experience, quite difficult.

Like Xamarin Forms, .NET MAUI helps you target multiple platforms in the same project, but as a newer product, MAUI also streamlines that process somewhat while expanding the list of platforms to include, among other things, Windows and Mac (and Tizen). As such, it provides capabilities that only make sense on the desktop, like the ability to open multiple windows, access mouse pointer gestures, and display tooltips. And new controls, like Menu Bar and Context Menu.

As such, it’s not difficult to imagine taking an existing mobile app---perhaps one that runs on iPhone, iPad, and Android---and adapting it so that it feels more natural on the Windows (or Mac) desktop. Maybe your app will display a menu bar on Windows, for example, or use a floating window for its About box.

But we don’t have to just imagine this, we can do it: when you create a new .NET MAUI app in Visual Studio using the wizard, it creates a basic mobile app with the MAUI robot and a button that increments a count when clicked. And we can tailor that basic app with a few basic desktop controls and capabilities that only appear when the app is run on the desktop.

To do so, install Visual Studio 2022 Community with the .NET Multi-platform App UI development workload. Then, create a new project and select the .NET MAUI App project template. (You can find it most easily by using the filters at the top; for exam...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC