Happy birthday .NET MAUI!
Today is one year since the first release of .NET MAUI. For this year we saw a lot of features and improvements and each day .NET MAUI becomes more and more stable. One of the main features of .NET MAUI is Shell.
.NET MAUI Shell is an application container provided by the .NET MAUI to facilitate the development of cross-platform applications. It offers a variety of features such as navigation, integrated search, and many customizable components that enhance the application's appearance and performance.
Customizing .NET MAUI Shell for Android
To customize your .NET MAUI Shell app for Android, you can change various components of the ShellRenderer class in the Platforms/Android/
directory of your application. Here's an example:
Create a custom ShellRenderer class:
To customize
BottomNavView
create a new classCustomBottomNavViewAppearanceTracker
. It adds rounded corners and margins:
Similar to the
BottomNavView
, to customizeToolbar
create a new classCustomShellToolbarAppearanceTracker
. It adds rounded corners and margins:
Customizing .NET MAUI Shell for iOS/MacCatalyst
Similar to customizing Android, you can make customizations for iOS and MacCatalyst by modifying the ShellRenderer class in the Platforms/iOS/
and Platforms/MacCatalyst/
directories of your application.
Create a custom ShellRenderer class:
To customize
TabBar
create a new classCustomShellTabBarAppearanceTracker
. It adds rounded corners and margins:
Similar to the
TabBar
, to customizeToolbar
create a new classCustomShellToolbarAppearanceTracker
. It adds rounded corners and margins:
Summary
The final step is registering our handlers:
That's all we need to customize .NET MAUI Shell. Run the application and see the result:
The full code can be found on GitHub.
Happy coding!