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

  • Simulated Annealing Optimization Using C# or Python

    Dr. James McCaffrey of Microsoft Research shows how to implement simulated annealing for the Traveling Salesman Problem (find the best ordering of a set of discrete items).

  • Microsoft Offers Windows ML Samples Gallery

    Microsoft has created a Windows ML Samples Gallery of interactive projects to showcase Windows machine learning functionality in both managed and native scenarios.

  • New Lightweight JetBrains Editor Draws VS Code Comparisons

    Software development tooling vendor JetBrains debuted a new lightweight code editor that can act like a full-fledged IDE, immediately drawing comparisons to Microsoft's Visual Studio Code.

  • WinUI 3 Team Asked About Delayed Open Source Plans: 'What Happened?'

    A developer asked Microsoft's WinUI 3 dev team about delayed open source plans for the nearly two-year-old project that serves as the company's next-gen UI library for creating Windows apps.

Upcoming Events