This is a follow-up article describing the new features added to the latest release that supports .NET MAUI RC1. For installation and options available in this template, a detailed article is linked here.
This release is now loaded with 4 new features:
- App Theming support for .NET MAUI Blazor Hybrid project
- Conditionally enabled the BlazorWebView Developer Tools for crafting a pixel-perfect UI
- Style definition has been further restructured to better scale for Font, FontSize, Light, and Dark theme-specific property definitions
- For more details, refer to the Styles.xaml file in the Resources folder
- Included a VS Code Workspace file with the project to work seamlessly across IDEs
The Blazor Hybrid project is cool in that it paves the way to reuse the Razor web components in a native App Shell along with access to all the device capabilities. But the default .NET MAUI Blazor project is still with the light theme. It doesn’t respond to the Theme changes. This has been addressed in this release. And also for new developers gives an overview of how Essentials can be used to interop between MAUI and Razor code.
From this RC1 release, the way the dependency registration of BlazorWebView is streamlined across all supported frameworks (.NET MAUI, WinForms, and WPF). A separate article has been published here to cover those changes. In which, the Developer Tools need to be enabled explicitly to work with it. It’s a must for crafting a pixel-perfect UI or delving into the details if something goes wrong. And this has been conditionally included for Debug build by default in the latest template.
The default style for controls is always good to have. It provides a way to modify the appearance of the controls quite easily. But in real-world apps, it is also necessary that the styles should scale to the project needs. For which the change should be minimal and maintained in one place. So, the default style has been further restructured to cater to that need in mind, especially Theming properties such as Font, FontSize, BackgroundColor, and TextColor. So those properties have been abstracted as separate resources and mapped to the corresponding style properties of the controls. Hence changing these abstracted properties will replicate in all those places, thus making it easy to maintain.
Since VS2022 for Mac is still under preview and is yet to be enabled for full-fledged .NET MAUI development. For users on macOS, VS Code, with Clancey’s Comet for .NET Mobile extension, and command-line are good friends at work. A separate article has been published on how to provision VS Code as an IDE for .NET MAUI. Since VS Code won’t recognize the VS solution or project file, a workspace file has been included while creating the project from this All-in-One template, so that it becomes easy to open and work with the MAUI app in VS Code.
Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a .NET developer.