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:
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);
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.
Thanks for the new infos, but will there be any WPF to MAUI migration guide?
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...
What could be the option for the database in .net MAUI ? OR we can use MS SQL same as in framework.
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 ? ...
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...
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
<code>
SettingsPage.xaml.cs
<code>
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.'"
Currently, I can't get the workload to work in Visual Studio, my Maui project is just a class library. Trying to manually install
dotnet workload install maui
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: microsoft.net.workload.mono.toolchain.manifest-6.0.200 is not found in NuGet feeds https://api.nuget.org/v3/index.json, https://aka.ms/maui-preview/index.json, C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"..
maui-check also throws errors and can't install the same ver 6.0.2 packages.
.NET SDK - Workloads (6.0.100) Checkup...
x android-aot (Microsoft.NET.Sdk.Android.Manifest-6.0.100...
Hi David,
Good news that you are on track to ship a release candidate in Q1 2022, can you pinpoint when the https://github.com/dotnet/maui/wiki/status will be feature complete? I am specifically referring to Label.FormattedText. Looking at the .NET Maui code it doesn’t appear to have started on any platform yet.
Preview 12 would be great. 😉
Thanks
John
When will Visual Studio Mac be available to support .NET Maui? Thanks.
2 things:
is there a link to any updated documentation for including a BlazorWebView control in a WinForms app?
aside from HTML, is it naive to think Microsoft could produce a common UI library between Windows and web MAUI apps in a similar fashion to Flutter, which I think uses Skia?
There will be BlazorWebView in WinForms documentation published in the Blazor docs, not .NET MAUI. It's on the way.
Re: a common UI lib that achieves all of that from a single codebase, today you can look at the Uno Platform.
We hear mostly from customers that they want native UI on each platform, which means web uses web tech, mobile uses mobile, and desktop .etc. and then specific controls/experiences leverage solutions like Skia when you need...
David,
I agree - probably there are customers (developers?) wanting native UI on each platform. But there are also developers wanting XF/MAUI supported on the web. For us third-party Uno is a no-go - even we use their XF renderers it probably will not be the fastest approach and rewriting XF XAML to UWP XAML is not a serious option as MAUI XAML is successor in this case.
Why would you press us to write desktop apps...
David, if I may ask, why not offer both ways (native UI and custom(e.g. skia)UI)? Is it because there is no time/budget or its more of technical problem? You said its because customers want mostly nativeUI but I am sure all devs can see that flutter is getting more and more popular so that means many customers want rendered UI as well.
My point here is that if you will offer more UI options, then MAUI...
Thank you David for reaching out. Microsoft.Maui.Graphics.Controls sounds exactly what I would say is a very big deal indeed. This with a design surface has to be the icing on top of the VS and .NET cake. Perhaps one day we could even draw assets in things like CorelDraw or Illustrator and then add the code behind. It would be simply awesome.
How can I provide feedback?
PS in trying to create a MAUI Blazor project, I...