Customizing .NET MAUI Shell

Customizing .NET MAUI Shell

23 May 2023

.NET MAUI/Xamarin

Buy Me A Coffee

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:

  1. Create a custom ShellRenderer class:

  1. To customize BottomNavView create a new class CustomBottomNavViewAppearanceTracker. It adds rounded corners and margins:

  1. Similar to the BottomNavView, to customize Toolbar create a new class CustomShellToolbarAppearanceTracker. 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.

  1. Create a custom ShellRenderer class:

  1. To customize TabBar create a new class CustomShellTabBarAppearanceTracker. It adds rounded corners and margins:

  1. Similar to the TabBar, to customize Toolbar create a new class CustomShellToolbarAppearanceTracker. 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:

.NET MAUI Shell Android

Shell on Android

.NET MAUI Shell iOS

Shell on iOS

.NET MAUI Shell Windows

Shell on Windows

The full code can be found on GitHub.

Happy coding!

Buy Me A Coffee

Related:

Testing .NET MAUI Application using Appium and xUnit

Elevate your .NET MAUI application testing with precision using Appium and xUnit.

Simplifying .NET MAUI App Development with Debugging and Monitoring Tools

Simplifying .NET MAUI App Development: Debugging and Monitoring Tools.

An unhandled error has occurred. Reload

🗙