Announcing .NET MAUI Preview 11

David Ortinau

Today we are pleased to share .NET Multi-platform App UI (MAUI) Preview 11. In this release we have added the first batch of Fluent UI control styling, multi-window implementations, control features, and another set of iOS type alignment. These ongoing .NET MAUI previews run on the latest preview of .NET 6 and are available with the new Visual Studio 2022 17.1 Preview 2 on Windows shipping today. We are on track to ship a release candidate in Q1 2022, and final release in Q2 2022.

The source for the .NET Podcast app showcased at .NET Conf 2021 has been published, and includes Blazor, .NET MAUI, and .NET MAUI Blazor Hybrid apps.

Let’s take a deeper look at the highlights in preview 11.

Windows Control Styling with the Fluent Design System

.NET MAUI provides platform-specific design and experience by default, so your apps get the right look and feel for each platform from a single code base without any additional effort. Windows 11 introduces new UI styling with the updated Fluent Design System, and .NET MAUI styles all controls to use the latest. Subsequent previews will build upon this, adding more controls and support for themes. In Preview 11 you will see initial updates to:

side by side of button and entry styling

Multi-window Apps

One of the major updates to .NET MAUI compared to Xamarin.Forms is introducing multiple windows. Application.Current.Windows holds references to all windows you have created. To open a new window, it’s as simple as:

var secondWindow = new Window {
    Page = new MySecondPage {
        // ...
    }
};

Application.Current.OpenWindow(secondWindow);

multiple windows for Weather app on macOS

To try this today targeting macOS and iPadOS, add a SceneDelegate to each respective platform folder and update your info.plist to enable scenes.

Did you know? This image is an iPad simulator running on Windows using the Remoted iOS Simulator available when you connect to a Mac build host. Alternatively, you can debug any .NET MAUI app on a device running iPadOS (or iOS) directly from Visual Studio 2022 on Windows using Hot Restart.

The Windows App SDK implementation of multi-window will be in an experimental release until release in v1.1 (see roadmap).

Templates and C# 10

Simplification is one of the main goals of .NET MAUI, to make it easier for everyone to build great apps. Going from multiple projects per platform to a single project is just one example of how we are doing that. In this release we have updated the templates using C# 10 patterns such as implicit usings and file-scoped namespaces, and added item templates for ContentPage and ContentView. Now when your project opts-in to using ImplicitUsings you’ll see a cleaner project file like our template’s MauiProgram.cs.

namespace Preview11;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });

        return builder.Build();
    }
}

So, where did all the using statements go? We use implicit global usings to gather them dynamically so you don’t need to worry about it.

iOS, macOS, and tvOS Type Alignment

As part of unifying Xamarin SDKs with .NET 6, we have been working through updating our Apple related SDKs to use the native nint and nuint types in .NET 6 rather than System.nint and System.nuint. This impacts existing libraries built for iOS, macOS, and tvOS using .NET 6. To adopt this change you must recompile your code against .NET 6, and if you explicitly use the types above you should update your .NET 6 code to use the C# types.

Read the issue for this change on GitHub for more details.

New .NET MAUI Documentation

We have published a new batch of documentation for .NET MAUI including new guides for Accessibility, BlazorWebView, Border, GraphicsView, Maui.Graphics, Shadows, Splash Screen, multi-targeting, and how you can invoke platform code. Xamarin.Forms documentation is in the process of being ported and updated to .NET MAUI, and we’ll be publishing regularly from here on out. Anytime you cannot find the .NET MAUI documentation you need, check to see if there’s a Xamarin.Forms doc available since most of the concepts all apply to .NET MAUI as well.

Get Started Today

Before installing Visual Studio 2022 Preview, we highly recommend starting from a clean slate by uninstalling all .NET 6 previews and Visual Studio 2022 previews.

Now, install Visual Studio 2022 Preview (17.1 Preview 2) and confirm .NET MAUI (preview) is checked under the “Mobile Development with .NET workload”. If you already have 17.1 installed, then you can just perform an update from the Visual Studio installer.

Ready? Open Visual Studio 2022 and create a new project. Search for and select .NET MAUI.

Preview 11 release notes are on GitHub and we have captured the top changes in a migration guide in the wiki. For additional information about getting started with .NET MAUI, refer to our documentation.

Feedback Welcome

Please let us know about your experiences using .NET MAUI to create new applications by engaging with us on GitHub at dotnet/maui.

For a look at what is coming in future releases, visit our product roadmap, and for a status of feature completeness visit our status wiki.

31 comments

Comments are closed. Login to edit/delete your existing comments

  • Vincent van der Vlis

    How would one navigate to a second page? Have looked but nothing applicable on web, preview = bleeding edge! 😉

    This works on Windows but not Android:

    MainPage.xaml.cs

        private void OnSettingsClicked(object sender, EventArgs e)
        {
                App.Current.MainPage = new SettingsPage();
        }

    SettingsPage.xaml.cs

        private void OnBackClicked(object sender, EventArgs e)
        {
            App.Current.MainPage = MainPage.Default; // Default is static variable set on constructor of MainPage.
        }

    Back works on Windows, last but gives following error on Android:
    “Java.Lang.IllegalStateException: ‘The specified child already has a parent. You must call removeView() on the child’s parent first.'”

  • Masoud Moghaddam

    Hi, I want to use maui in a project where the user’s location is always displayed on the map, an application like uber or taxi.yandex, while I only know blazor, and I want to use the component I created for the map in Blazor, with Lat , long that I got from native codes. Is it possible?
    And the next question is…
    1 what is the future for Maui?
    2 Can I get web app output from maui like Flutter in the future?
    3 Can Maui eliminate me (in the future) from Flutter or React Native? Or will his fate be like Xamarin?

  • SELLÉS Yannick

    Hi. its going well. I’ve moved to MAUI to port an existing desktop windows app (c#/wpf/c++cli/c++/c) to mobile. It has a large c++ lib that I’ve managed to wrap and load at run time in the Android sim. This c++ lib need some files but I can’t figure out a way to joins the needed directory (many txt + binary files) in the project. Is it per/platform or generic int the Maui proj ? I’ve tried <MauiAsset Include=”Resources\Raw\dir /> but don’t know if it has any impact. I can’t find a way to explore my device file system as we can do it in Android Studio. In fine I need to tell my c++ lib where are the resource files to load. I’ve already done that with Android studio.
    Regards.

  • Chandan Yadav

    What could be the option for the database in .net MAUI ? OR we can use MS SQL same as in framework.

  • Jeff Lewis

    Is this a move from “Native Controls” to a more WPF “Styled Controls” approach?

    If so, let me applaud that decision. I’ve been begging for this literally for years.

    It’s easy to theme XAML to look native, but it can be almost impossible to create a new control for which there is no native equivalent and it can make anything other than trivial “button/input/panel” apps really difficult to write crossplatform.

    (On the other hand, I wrote a complete MacOS Aqua control set clone in VB.Net for .Net Forms in 2003 because a Mac fan insisted that .Net and PCs didn’t have the ‘hulking power needed to do a UI like Aqua’… so never underestimate the determined… 🙂 )

  • Mursel Musabasic

    Thanks for the new infos, but will there be any WPF to MAUI migration guide?