Insights into the .NET Multi-Platform App UI — MAUI
Microsoft’s latest cross-platform offering .NET MAUI is the next generation of Xamarin.Forms and is the evolution of Xamarin.Forms toolkit. .NET MAUI (.NET Multi-platform App UI) will bring commendable consistency to the developer experience and enable innovative and new experiences for developers.
Some of the main goals of .NET MAUI are modernizing and improving the design capabilities of the application and extending the applications from mobile platforms to desktop platforms starting with macOS and Windows.
Highlights of .NET MAUI
- Cross-Platform, Native UI
- Single Project, Single Codebase
- Deploy to multiple devices, mobile & desktop
Installation of .NET MAUI Check Tool
Run the below command in the terminal to install .NET MAUI Check Tool
dotnet tool install -g redth.net.maui.check
Once NET MAUI Check Tool installation is completed, run the below-mentioned command in the terminal to install all prerequisites that are required for .NET MAUI development.
The tool will check for
- OpenJdk / AndroidSDK
- .NET 6 Preview SDK
- .NET MAUI Templates
Whenever the tool prompts to “Attempt to fix?”, type ‘y’ to continue.
After successful installation, Press enter to exit.
Single Project for multi Platform
The main aim of .NET MAUI is improving app performance and simplifying multi-platform app development. This framework will provide developers with a single codebase that has built-in resources to access the native API for all modern operating systems (Android, iOS, macOS, Windows). Developers will be able to develop multi-platform applications easily under a single project structure and they can also add different resources or source code files for each platform when necessary.
The native features of every platform and their controls are readily available through a simple, cross-platform API that delivers no-compromise user experiences while enabling developers to share even more code than ever before!
In .NET MAUI We may enable app themes for the whole application through styling for Fluent UI and Material Design, filling out the pre-existing controls with the specified styling APIs and visual states, and adding support for control templates. On the experiment front, we can also have a new visual strategy that uses a consolidation of native controls and drawn controls.
There are several situations such as app startup and UI responsiveness. In an application where performance is often a critical quality issue. The new handler design in .NET MAUI removes view wrapping, lowering the number of UI components required to render a view. It also fundamentally disassociates the platform controls from the framework itself. In Xamarin.Forms each renderer has a reference to the cross-platform element and mostly relies on INotifyPropertyChanged to work but .NET MAUI introduces a new pattern named a handler instead of using renders.
In this relationship, the platform and the framework are now inverted, so all the platform control needs to handle is the needs of the framework. This is not only more efficient but also makes it much easier to extend or override when needed.
.NET Hot Reload
One of the foremost productivity boots for developers within the past few years has been the introduction of XAML Hot Reload. When we make changes to a XAML file, the changes are delivered to our running applications and hot reloaded, allowing us to avoid the time-consuming build and deploy cycle that can annoy and distract even the most seasoned developer. In .NET 6 they are expanding this to C# and introducing it to other workloads as well.
Thus Xamarin.Forms developers will find it easy in running new projects in .NET MAUI because it is nearly using equivalent controls and APIs which they already know and understand. In order to help developers possess a smooth transition of existing apps to .NET MAUI they also provide try-convert support and migration guides almost like what we’ve today for migrating to .NET Core.
Author: Kalpana Balasubramaniyan