How to customize everyone Tab in TabBar

Иван Константинов 0 Reputation points
2023-09-21T06:41:01.4666667+00:00

For example, I want create Shell with TabBar. BG of TabBar must be blue, and BG of Current Tab in TabBar must be orange. How can I do it?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,369 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 41,601 Reputation points Microsoft Vendor
    2023-09-25T03:25:43.0033333+00:00

    Hello,

    In MAUI, the shell does not provide background familiarity that can be set separately in the selected state.

    The Shell provides properties that allow you to change the font and Icon color after selection.

    You could add the following code into AppShell.xaml.

    <Shell.Resources>
        <Style TargetType="TabBar">
            <Setter Property="Shell.UnselectedColor" Value="Aqua" />
            <Setter Property="Shell.TabBarBackgroundColor" Value="White" />
            <Setter Property="Shell.TabBarForegroundColor" Value="Black"/>
            <Setter Property="Shell.TabBarUnselectedColor" Value="Blue"/>
            <Setter Property="Shell.TabBarTitleColor" Value="Red"/>
        </Style>
    </Shell.Resources>
    

    For the need to change the background color, you can publish it to the MAUI repository to make our development team aware of this.

    Best Regards,

    Alec Liu.


    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 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.