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 for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube