Telerik blogs

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 (.NET MAUI)—the evolution of modern .NET cross-platform developer experience. Going forward, developers will be empowered with .NET MAUI technology stack and tooling to build native cross-platform apps for mobile/desktop from single shared codebase.

While it may take a long flight to reach the sands of MAUI island, developer excitement around .NET MAUI is quite palpable with all the created 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 May 1, 2023:

Drawing on .NET MAUI Maps

Many modern mobile/desktop apps deal with geolocation data and as such, a customizable mapping solution is key for developers powering such experiences. .NET MAUI is more than happy to oblige with a feature-rich Map control for iOS, Android and MacCatalyst—it's been available since .NET MAUI for .NET 7 launch.

While the .NET MAUI Map UI renders full-fidelity maps across platforms, the real power is in customizations—developers have full drawing capability on top of Maps, with polygons, polylines and circles. Cross-platform mapping solution is enticing and James Montemagno wrote up an in-depth article—drawing elements on Maps with .NET MAUI.

The Map UI in .NET MAUI can be customized in various ways, and James begins with the most common thing developers may have to do—dropping Pins on the map. Pins can be declared directly into the visual tree with XAML or used with Data Binding for dynamic addition to the rendered map. The MapElements property of the Map UI in .NET MAUI allows for three types of elements to be added—Circle, Polygon and Polyline. A combination of the three elements should allow developers plenty of flexibility to customize the Map UI for geolocation solutions as needed for maps based apps or enterprise workflows.

James showcases the flexibility of .NET MAUI Map UI by drawing an overlay over the Microsoft Campus in Redmond with a line showing the walkway between the East and West campus—plenty of reasons for developers to feel inspired and build amazing .NET MAUI apps with Map UI.

Migration to .NET MAUI

.NET MAUI is the direct evolution of Xamarin.Forms, taking .NET code to not just iOS/Android but also to Windows/macOS. While .NET MAUI is the future of cross-platform development on .NET, for many teams/individuals, Xamarin.Forms is very much the reality today. Thankfully, investments in Xamarrin.Forms move forward nicely, but there are some nuances to understand and plot the migration to .NET MAUI. Rossitza Fakalieva has had some migration experience and wrote up the last part of a wonderful article series—tips and tricks for migration from Xamarin to .NET MAUI.

Rossi lays down some realistic things to consider as developers plot the migration from Xamarin.Forms to .NET MAUI—reviewing app architecture, analyzing dependencies and using the .NET Upgrade Assistant tool to assist in automating migrations. Coming from the Xamarin world, some XAML Namespaces and UI components may have to be updated, and developers should be aware of Layout changes in .NET MAUI. The true single shared project system in .NET MAUI should help with shared resources and dependencies, while there is also more help with design patterns like MVVM. If developers have written custom Renderers for Xamarin.Forms, they can be brought in as is in .NET MAUI with Compatibility mode, but the right thing would be to migrate them to be .NET MAUI Handlers.

It's not just talk though, as Rossi has taken a full-blown ERP app that is in the App Stores and migrated it from Xamarin to .NET MAUI—this article series should provide a lot of confidence.

.NET MAUI came out with .NET 6, matured with .NET 7 and is looking ahead to flourish with .NET 8—hopefully, developers can follow the natural evolution of Xamarin.Forms apps to .NET MAUI, sooner than later.

.NET Community Toolkit

The .NET Community Toolkit is a collection of MVVM Helpers, Code Generators, Diagnostic/Performance tools and APIs that work for all .NET developers, agnostic of any specific UI platform. The toolkit is open source, maintained and published by Microsoft, and is a part of the .NET Foundation. There is a new version of the .NET Community Toolkit and Sergio Pedri wrote up the announcement—.NET Community Toolkit 8.2 is now out.

The .NET Community Toolkit includes several libraries—CommunityToolkit.Common, CommunityToolkit.Mvvm, CommunityToolkit.Diagnostics and CommunityToolkit.HighPerformance.

MVVM is a design pattern that has always worked well for C#/XAML codebases and .NET MAUI is no exception—the MVVM Toolkit inside the .NET Community Toolkit makes it a great companion for .NET MAUI developers. No more writing boilerplate MVVM code—much of the bindings, events and properties are automatically wired up by source code generators.

In .NET Community Toolkit 8.2, there are new custom attributes for RelayCommand fields—this gives developers full control over attributes for all generated members. The MVVM Toolkit 8.2 release also sports two new property change hooks being generated for all ObservableProperty fields—the “OnPropertyNameChanging” and “Changed” methods provide easy hooks to use to inject code that’s triggered on each property change event. There are also MVVM Toolkit source generator optimizations and plenty of bug fixes—the .NET Community Toolkit is fast becoming an indispensable companion for all .NET developers, especially if doing MVVM. Cheers, Sergio and team.

OpenAI Completions with .NET

Artificial intelligence (AI) is eating the world and changing the way we live and work. The popularity of AI-driven solutions is driving most technology companies to sprinkle AI power in many consumer-facing products, and AI is increasingly making its way into the developer tools.

OpenAI is an AI research/deployment company—creators of the models powering experiences like ChatGPT. There is a lot of potential in AI usage for .NET/.NET MAUI developers and Luis Quintanilla wrote up a blog post—getting started with OpenAI Completions in .NET.

Luis starts out with the basics of Completions—essentially responses generated by a model like GPT. Completions are generated from user input (prompt) and driven by a model, whose capabilities depend on the data and algorithms used to build the model. The algorithms used to build OpenAI models like GPT are neural networks known as Transformers—often referred to as Large Language Models (LLMs) because of their size and type of problems they’re designed to solve.

Luis talks about breaking down user input into Tokens and how .NET developers can get started working with completions—Azure OpenAI Service and the OpenAI .NET samples are here to help. OpenAI-powered AI solutions hold a lot of promise for .NET/.NET MAUI applications—yummy opportunities ahead.

.NET @ Microsoft Build

Microsoft’s premier developer conference is coming up soon—Build 2023 is happening May 23-25.

This year, Build is both virtual and in-person in Seattle. While developers can watch many sessions live online, for folks joining in-person, there are lots of interaction opportunities, like meet the experts, demo areas, workshops and more. There is plenty for .NET developers to look forward at Build and Mehul Harry wrote up a post—join the .NET Team at Microsoft Build 2023.

Build has a lot of content to offer across all of Microsoft technology stacks—the entire session catalog is now online. However, Mehul called out a few sessions that should be particularly relevant to .NET developers—like Cloud Native with .NET 8, .NET modernization and performance, C# 12 and what's new with web development with modern .NET.

For developers looking for .NET MAUI news, much of the team will be there to share the latest across the .NET MAUI ecosystem, as well as roadmap. Microsoft Build 2023 is shaping up to be fun—registration is open!

That's it for now.

We'll see you next week with more awesome content relevant to .NET MAUI.

Cheers, developers!


SamBasu
About the Author

Sam Basu

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.

Related Posts

Comments

Comments are disabled in preview mode.