How to customize Shell tabs?

Igor Kravchenko 281 Reputation points
2022-06-09T14:42:52.97+00:00

Hi!
I want to customize Shell tabs on handler level. Is there any ShellHandler or TabBarHandler?
Thanks.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,845 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,176 Reputation points Microsoft Vendor
    2022-06-10T08:45:03.603+00:00

    Hello,​

    Is there any ShellHandler or TabBarHandler?

    No. But you can create custom renderer like Xamarin.Forms for Shell (No need to add [assembly: ExportRenderer(typeof(Shell), typeof(MyShellRenderer))]). If you want to create a custom tabbar. Nomally, for android, you need to override CreateBottomNavViewAppearanceTracker. For iOS, you need to override CreateTabBarAppearanceTracker method.
    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/customrenderers

    Then, register your custom renderer for shell in the MauiProgram.cs.

       builder.UseMauiApp<App>()  
             .ConfigureFonts(fonts =>  
             {  
                  ....  
             }).ConfigureMauiHandlers(handlers => {   
                    
                               #if ANDROID  
                                   handlers.AddHandler(typeof(Shell), typeof(CustomShellRenderer));  
                               #elif iOS  
                                    handlers.AddHandler(typeof(Shell), typeof(MyiOSCustomShellRenderer));  
                        
                               #endif  
         
         
                   });  
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful