Recently, we released. NET multi-platform application UI (MAUI) latest developments. In this release, we fully support Visual Studio 2022 Preview 2. It also marks the first time that we will. NET MAUI is installed and distributed as a workload. A number of new features are now available, including gestures, modal pages, view clips, native warnings, flexible layouts, and more. Individual projects also continue to improve with the adoption of the latest versions of the Windows application SDK and Visual Studio extensions. Let’s take a closer look.

Workload installation

As part of.net unity, we introduced the concept of SDK workloads to be installed on your. NET SDK to enable specific developer scenarios. In Preview 4, the underlying SDK was enabled for Android, iOS, macOS, and Mac Catalyst, and now in Preview 6, we have introduced the Maui, Maui-Mobile, and Maui-Desktop workloads. This is the first build that will get and install. All SDKS required for NET MAUI applications. If you only want to locate mobile or desktop devices, you can select them separately.

In the near future, Visual Studio 2022 will include these in its installer. To use them immediately, jump to your favorite CLI. First, take a look at what you already have installed:

dotnet sdk check

This reports what was installed via the.NET SDK installer itself. Now look at the additional workloads running:

dotnet workload list

After installing.NET MAUI, you can perform:

dotnet workload install maui

  • How about Maui-Check dotNet? We will continue to update Maui-Check with each release, as it does additional validation of your development environment to help you succeed: checking OpenJDK, emulators, Xcode, Visual Studio releases, and so on.

For more information about mobile and desktop workloads, read the details here.

New.NET MAUI features

As you can see in our status report, we’re getting closer and closer to full green, so let’s highlight a few.

gestures

The gesture recognizer allows you to apply clicks, pinches, panes, swipes, and drag-and-drop to any view instance. You can easily apply them in XAML:

<Grid>
    <Grid.GestureRecognizers>
        <TapGestureRecognizer NumberOfTapsRequired="2" Command="{Binding OnTileTapped}"/> </Grid.GestureRecognizers> <! -- Grid content --> </Grid>Copy the code

In this example, when you double click on the weather widget block, it simulates a refresh with a fade out and fade in animation.

clipping

When you need to mask content, you can now add shapes to the clipping area of a layout or view. The most common use is to make circular images.

<Image Source="face.png">
    <Image.Clip>
        <EllipseGeometry RadiusX="80"
                         RadiusY="80"
                         Center="80" />
    </Image.Clip>
</Image>
Copy the code

The local warning

Each platform has its own way of presenting alerts to users. These can be simple pop-up Windows of information, simple input forms, or even action tables with multiple options to guide the user. These can be obtained from any page in a.NET MAUI application.

awaitDisplayAlert("Alert", "You have been alerted", "OK");

These are just some of the controls and layouts updated in Preview 6. For the full list, check out the commit log on GitHub. Preview 7 will make some radical changes to the layout, borders, corners, and shadows.

Individual projects and Windows

We made some updates to individual projects to adopt the latest features based on developer feedback and Windows support. Some of you have been following each version, and we love it! Thank you for providing feedback and interacting with us on GitHub and Discord. So, what changes in Preview 6 do you need to update in your existing solution?

  • The NuGet package has been replaced with. NET MAUI workload (true in.csproj).
  • Individual project solutions now nest individual platforms within the “Platforms” folder for neat organization.
  • Update to Windows Application SDK 0.8.1rc. Use the latest Visual Studio 2022 compatible extensions on the market.

today

First, install.NET 6 Preview 6. Now add the MAUI workload using the command above. Also make sure you’re updated to the latest preview of Visual Studio 2022, or if you’re using macOS, you can stick with the CLI and your favorite code editor as we await the debut of Visual Studio for Mac 2022.

Are you ready? Create the new application from the command line, and then open the solution in Visual Studio 2022.

dotnet new maui -n HelloPreview6

  • In future versions of Visual Studio 2022,.net MAUI templates will appear in “files “> Create “in the list. Until then, the CLI is your good friend.

Xcode 13 Beta 1 is the new minimum requirement for iOS and macOS. For additional information on getting started with.NET MAUI, see our documentation.

Welcome feedback

Let us know about your use by interacting with us at dotnet/ Maui on GitHub. NET MAUI Preview 6 create a new application experience.

To see what’s in future releases, visit our product roadmap.

Any technical questions, please ask in the Microsoft Q&A forum.