Welcome to the Sands of MAUI—newsletter-style issues dedicated to bringing together latest .NET MAUI content relevant to developers.
A particle of sand—tiny and innocuous. But put a lot of sand particles together and we have something big—a force to reckon with. It is the smallest grains of sand that often add up to form massive beaches, dunes and deserts.
Most .NET developers are looking forward to .NET Multi-platform App UI (MAUI)—the evolution of Xamarin.Forms with .NET 6. Going forward, developers should have much more confidence in the technology stack and tools as .NET MAUI empowers native cross-platform solutions on mobile and desktop.
While it is a long flight until we reach the sands of MAUI, developer excitement is palpable in all the news/content as we tinker and prepare for .NET MAUI. Like the grains of sand, every piece of news/article/video/tutorial/stream contributes towards developer knowledge and we grow a community/ecosystem willing to learn and help.
Sands of MAUI is a humble attempt to collect all the .NET MAUI awesomeness in one place. Here's what is noteworthy for the week of January 24, 2022:
Just like that, the next version of .NET MAUI aka Preview 12 is now out—David Ortinau wrote up the usual announcement post. As .NET MAUI advances towards Release Candidate builds, the focus of the engineering work slowly shifts towards stabilizing the releases and quality improvements—nonetheless, there are some wonderful enhancements in this release.
.NET MAUI Preview 12 gives quite a bit of love to the Shell—the app scaffolder that simplifies common app design patterns with out-of-the-box flyout menus and tabs. With URI based navigation built-in, the shell is meant to get developers to a good starting point—it's used extensively in the .NET Podcast sample app.
.NET MAUI also uses the generic .NET HostBuilder pattern to bootstrap apps and this opens up easy Dependency Injection—DI is now welcome for the Shell or regular Pages/Views/ViewModels. All this .NET MAUI goodness is available to tinker with today with VS 2022 17.1 Preview 3 or through CLI tools—go get the hot bits.
Xamarin.Forms has always had the concept of a Renderer—a piece of code that renders native UI consistently for each platform from abstracted code. Developers could override specific controls behaviors by creating a Custom Renderer for each platform—these needed to be registered at the Assembly-level, and accessing platform-specific code was not easy. .NET MAUI flips all of this on its head with the new Handler architecture—Steven Thewissen wrote a wonderful post dissecting the Handler infrastructure.
Handlers eliminate the tight coupling Xamarin.Forms Renderers had with underlying native control UI—this is done through generic interfaces that have specific implementations from a variety of platform abstractions. The slow assembly scanning with Reflection is now replaced by Handlers that are explicitly registered for each platform in app startup code.
Handlers also make it more intuitive reach platform-specific code and Mappers dictionaries know exactly how to handle property changes in native UI—this is a great architectural change in .NET MAUI.
If .NET MAUI Handlers have piqued your interest, it should be time for a deeper dive. Damien Doumer continues his exploration of .NET MAUI and has published a wonderful deeper look at Handler architecture in .NET MAUI. Damien starts with the basics of Handlers and highlights the benefits of switching to the new architecture from Xamarin.Forms Renderers.
Next up comes the deeper dive into customizing UI through Handlers—modifying each control or types of controls or specific control instances for each platform. Damien shows easy to follow examples of how to customize UI through Handlers by invoking specific methods to modify mappings to native controls, during various stages of mapping for properties.
This is a great read to understand .NET MAUI Handlers better and for developers to know exactly what is needed to customize rendered UI across various platforms.
Modern mobile development is a cutthroat race for user attention—anything developers can do to engage the audience helps. Modern UI and UX demands smooth motions, transitions and pizzaz—all achieved through animations.
Thankfully, much of the needed animations are built into mobile developer frameworks—James Montemagno produced a video on animating controls with .NET MAUI and Xamarin.Forms.
With little effort, developers can add simple animations in code, chain multiple animations together or create custom animations—the docs are here to help. Furthermore, animations can be synchronized to work with built-in MVVM design pattern or with MVVM frameworks—James does the usual smooth job of demonstrating the how-to's with easy-to-follow examples. Go animate to your heart's content and amaze your users.
One of the big benefits .NET MAUI brings to the developer experience is Single Project—a true consolidated SDK-style single project that uses multi-targeted .NET 6 builds to reach various mobile/desktop platforms from a single codebase.
This is a wonderful step forward compared to the present Xamarin.Forms reality and promises to better manage large cross-platform projects. But what about resources for each targeted platform—can those be shared in a single project?
Leomaris Reyes wrote up an article demystifying the .NET MAUI single project architecture—this is a must-read to better understand how a single codebase and shared resources are being managed to reach various platforms. Leomaris explains how developers in the .NET MAUI no longer have to add platform-specific resources—the common things like images, splash screens, icons, fonts and more are now shared.
.NET MAUI uses smart builds to cater to the exact needs of each platform from the shared resources—any resizing/adjustments are automatically made at build time before app bundles are created per platform. If developers want to use specific resources for any platform other than the shared ones, they can be easily placed in the platform-specific folders for the build to pick up—this is total win in .NET MAUI.
That's it for now.
We'll see you next week with more awesome content relevant to .NET MAUI.
Sam Basu is a technologist, author, speaker, Microsoft MVP, gadget-lover and Progress Developer Advocate for Telerik products. With a long developer background, he now spends much of his time advocating modern web/mobile/cloud development platforms on Microsoft/Telerik technology stacks. His spare times call for travel, fast cars, cricket and culinary adventures with the family. You can find him on the internet.
Subscribe to be the first to get our expert-written articles and tutorials for developers!