News

.NET MAUI Preview 6: SDK Workload Installation, Gestures, Clipping, Alerts, More

.NET MAUI has been improved in many ways in this week's release of .NET 6 Preview 6 as the evolution of Xamarin.Forms (NET Multi-platform App UI), which adds desktop support to the traditional iOS and Android mobile development, takes shape.

.NET 6 Preview 6 shipped July 14, featuring better Live Preview and Hot Reload functionality, along with many other improvements.

For .NET MAUI, soon to subsume Xamarin.Forms as Microsoft's go-to mobile dev option, one major change in Preview 6 is that it now works with Microsoft's new concept of SDK workloads to enable specific development scenarios on top of the main .NET SDK.

.NET MAUI
[Click on image for larger view.] .NET MAUI (source: Microsoft).

The SDK workloads scheme will replace the old monolithic SDK approach, which was burdened by a long build times and large distribution sizes.

"Instead, all new workloads will be built and delivered separately from the SDK, and will be acquirable via your favorite installation tool (like the Visual Studio Installer, a Linux package manager, or the .NET CLI)," Microsoft said last month in announcing .NET 6 Preview 5. "In the fullness of time, we intend for all .NET workloads to follow this pattern, resulting in a very small and focused SDK."

Partially into the fullness of time, .NET MAUI workloads now follow this pattern. David Ortinau, principal program manager, .NET Multi-platform App UI, recently discussed the change in what was called the Final Xamarin Podcast. Ortinau discussed the new SDK loading experience, which he called a "network load," using the new dotnet network install command. It's backed by NuGet, which is used by Microsoft to install Android, iOS, macOS, .NET MAUI, Blazor and other tooling. "So with the dotnet installer, you can actually install optional workloads, of which MAUI is now one," said Ortinau. "So if you are a command-line junkie and you really, really enjoy getting getting your fingers dirty with keystrokes, then this is for you. So you can do a network load install command and pass MAUI as the workload ID and it will go out and grab all the SDKs that you need to be able to run a MAUI application."

He explained more in this week's announcement: "In preview 4 the underlying SDKs for Android, iOS, macOS, and Mac Catalyst were enabled, and now in preview 6 we are introducing the maui, maui-mobile, and maui-desktop workloads. The first will acquire and install all the required SDKs for building .NET MAUI applications. If you are only wanting to target mobile or desktop, you can choose those individually. In the near future Visual Studio 2022 will include these with its installer. To use them today, jump into your favorite CLI."

Speaking of Visual Studio 2022 -- which also shipped this week in Preview 2 -- Ortinau said "This release we are all-in on Visual Studio 2022 Preview 2." Developers can use the latest IDE preview to try out new .NET MAUI capabilities including:

  • Gestures: With gesture recognizers developers can apply tap, pinch, pan, swipe, and drag-and-drop to any view instance, easily applied in XAML.
    The Double-Tap Gesture in Animated Action
    [Click on image for larger, animated GIF view.] The Double-Tap Gesture in Animated Action (source: Microsoft).
  • Clipping: To mask content, coders can now add shapes to the clipping region of a layout or view, which is most often done to make a circle image or, as shown below, a crescent moon:
    Using Clipping to Make a Crescent Moon Image
    [Click on image for larger view.] Using Clipping to Make a Crescent Moon Image (source: Microsoft).
  • Native Alerts: "Each platform has a native way of displaying alerts to users. These can be simple informational popups, simple input forms, and even action sheets with multiple options to guide a user. These are available from any Page in a .NET MAUI application."
    Alerts in Animated Action
    [Click on image for larger, animated GIF view.] Alerts in Animated Action (source: Microsoft).
  • Single Project and Windows: Based on developer feedback, Microsoft made several updates to single project scenarios. Changes that will require updates in existing solutions include:
    • The NuGet package is replaced with the .NET MAUI workload (<UseMaui>true</UseMaui> in the .csproj).
    • Single project solutions now nest individual platforms within a "Platforms" folder for tidy organization.
    • Updated to Windows App SDK 0.8.1 RC. Use the latest Visual Studio 2022 compatible extensions from the marketplace.

While the above provides a snapshot of Preview 6, the .NET MAUI roadmap shows what's coming up next month in Preview 7:

  • App Lifecycle Events
  • Application Properties
  • Borders
  • Corners
  • Frame
  • MenuItem (Desktop)
  • Native Embedding (Context factory)
  • RefreshView
  • Shadows
  • SwipeView

For more information, readers can consult documentation, the GitHub repo and the status report, which shows how far various features are progressing to completion.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube