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 excited with .NET Multi-platform App UI (MAUI)—the evolution of modern .NET cross-platform developer experience. Going forward, developers should have much more confidence in the technology stack and tools as .NET MAUI empowers native cross-platform solutions on both mobile and desktop.
While it may take a long flight to reach the sands of MAUI island, developer excitement around .NET MAUI is quite palpable in all the shared content. Like the grains of sand, every piece of news/article/documentation/video/tutorial/livestream contributes towards developer knowledge in .NET MAUI and we grow a community/ecosystem willing to learn & 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 August 8, 2022:
.NET Conf is the defacto event for .NET announcements every year, with each November aligning with major .NET releases. However, there is plenty of excitement in the .NET ecosystem and by community demand, .NET Conf now hosts several Focus events throughout the year, deep diving into specific .NET technology stacks each time. And few things are as future-facing in .NET as .NET MAUI—which makes .NET Conf Focus on MAUI the thing for .NET developers to look forward to.
.NET Conf Focus on MAUI would be a one day free livestream event on August 9, 2022, bringing together folks who are most passionate about .NET MAUI. With speakers from Microsoft and developer community worldwide, .NET Conf Focus on MAUI will touch upon just about every aspect of .NET MAUI development stack—from getting started, C# 11, Design, DevOps, Blazor integration, code reuse and a lot more.
For developers with any iota of interest in .NET MAUI, August 9th should a no brainer—drop everything else and tune in for the most fun with .NET MAUI.
The .NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The .NET Community Toolkit was officially launched recently and Sergio Pedri wrote up the announcement—this is a big deal for any .NET developer.
The .NET Community Toolkit is live with NuGet package version 8.0.0—there is some history that makes this the first major release of the Toolkit. All the libraries of the .NET Community Toolkit were originally part of the Windows Community Toolkit—a collection of helpers, extensions and custom controls for Windows development.
Over time, APIs started targeting just .NET and it was prudent to make the split to benefit the general .NET developer audience. All the available APIs in .NET Community Toolkit have no dependencies on any specific runtime or framework, so they can be used by all .NET developers. These libraries multi-target from .NET Standard 2.0 to .NET 6, so they can both support as many platforms as possible and be optimized for best performance when used on newer runtimes.
While the Toolkit has several libraries, the CommunityToolkit.Mvvm one is the new Microsoft MVVM Toolkit—this is a big deal for any .NET developer using the Model-View-ViewModel (MVVM) design pattern. The Microsoft MVVM Toolkit is inspired by MvvmLight—now a a modern, fast, platform agnostic and modular MVVM library, particularly well suited for .NET MAUI. With built-in source generators and RelayCommand/ObservableProperty/NotifyPropertyChangedFor attributes, the Microsoft MVVM Toolkit really cuts down on the amount of boilerplate MVVM code developers have to write.
There is also a new MVVM Toolkit Sample App, with docs and interactive samples for many available APIs. The .NET Community Toolkit is open sourced—maintained and published by Microsoft, and part of the .NET Foundation. The goal is simple: Make .NET developers more productive. Cheers to that.
Once .NET MAUI apps are shipped, developers should not be in the dark as to how users are using the UI or if how the app is behaving—logging details can help. Logging is the age old way of explicitly writing out events, either within app lifecycle or triggered by user actions, that app developers can later dig through for context. Thankfully, client-side logging in .NET MAUI is easy with MetroLog.Maui and Gerald Versluis produced a wonderful video to get developers started.
MetroLog as a logging solution has been around for a while for other platforms, but it now caters to .NET 6 and .NET MAUI. Gerald starts out with the basics of client-side logging and how to integrate MetroLog.Maui into .NET MAUI apps with the NuGet package. A little bit of initialization and dependency injection later, developers should be ready to log system events or custom messages based on user interactions—to be written out to console, local files, in memory or to cloud backend integrations.
What is really sweet is Gerald showing off a key feature built into MetroLog.Maui—the ability for users to shake their device to display captured logs and easily share out log content for getting support. Gerald wraps up with some real world tips for using logging in .NET MAUI apps—bottom line, developers should have full visibility about running apps and never be in the dark, thanks to logging.
.NET MAUI is the .NET cross-platform story going forward and it may be enticing new developers to take the plunge. If building apps with C#/XAML, a key concept for developers to understand is Data Binding—the magic glue that holds the connection between the UI and data objects in code.
Data Binding is a core ingredient in MVVM design pattern that is particularly well suited for C#/XAML codebases, serving the likes of Xamarin.Forms and now .NET MAUI. Leomaris starts with the basics of how to dynamically link the UI presented to the user, and the Model/ViewModel behind the scenes—simple data binding syntax can bind UI element properties to data objects.
Starting with a ViewModel of a collection of students and their details, Leomaris is able to bind a CollectionView with appropriate templates that display the data faithfully. The real power of Data Binding and keeping a clean codebase comes from two key features—Two-way Data Binding and Commands that keep actionable code away from UI.
Writing a .NET MAUI app is half the battle—the rest is testing and shipping the app, which is particularly tricky for cross-platform apps. Some apps are destined for the Store, but they should ideally be tested beforehand by real users—and some enterprise apps are meant to be used directly by end users. Either way, what is called for is a nice distribution mechanism for getting apps in users' hands.
Even though the process is not particular to .NET MAUI, but rather for any IPA (iOS) or APK (Android) app packages, it is nice that Andreas begins from the basics for those uninitiated with Firebase. The workflow begins with creating an iOA/Android app in the Firebase console, with ApplicationId matching what is set in the .NET MAUI app. If app distribution is desired as a part of a CI/CD system, developers would need to create a Refresh Token in Firebase.
Andreas demonstrates how to hook up app distribution using Azure DevOps pipeline—the Firebase CLI helps with appropriate commands for iOS/Android. Bottom line, Firebase can be a legitimate solution for .NET MAUI app distribution and there is help for developers to get going.
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!
All fields are required