Skip to content

Shell Tabbar doesn't behave correctly when changing tab icon image (through binding or style triggers) #12105

@MK1985

Description

@MK1985

Description

Changing the App Shell tab icon using style triggers or through property binding causes the tab bar icon to behave incorrectly:

  1. Icon image changing mechanism starts to work after few initial clicks on tab bar icon.
  2. There is a strange icon shuffling/rearranging animation on tab icon change. See: App Shell tab icon change using Trigger cause rearrangement issue in Android , Works in IOS. #11520
  3. Tabbarselected color isn't maintained correctly when tab bar icon is being changed. It requires additional click to switch to correct state.

Steps to Reproduce

  1. Change Tab Icon Image through Style triggers or property binding

f.i:

<Shell.Resources>
    <Style x:Key="BrowseTab1" TargetType="Tab">
        <Style.Triggers>
            <Trigger TargetType="Tab" Property="IsChecked" Value="False">
                <Setter Property="Icon" Value="radio_off.png" />
            </Trigger>
            <Trigger TargetType="Tab" Property="IsChecked" Value="True">
                <Setter Property="Icon" Value="radio_on.png" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="BrowseTab2" TargetType="Tab">
        <Style.Triggers>
            <Trigger TargetType="Tab" Property="IsChecked" Value="False">
                <Setter Property="Icon" Value="radio_off.png" />
            </Trigger>
            <Trigger TargetType="Tab" Property="IsChecked" Value="True">
                <Setter Property="Icon" Value="radio_on.png" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="BrowseTab3" TargetType="Tab">
        <Style.Triggers>
            <Trigger TargetType="Tab" Property="IsChecked" Value="False">
                <Setter Property="Icon" Value="radio_off.png" />
            </Trigger>
            <Trigger TargetType="Tab" Property="IsChecked" Value="True">
                <Setter Property="Icon" Value="radio_on.png" />
            </Trigger>
        </Style.Triggers>
    </Style>
</Shell.Resources>



<TabBar>
    <Tab
        Title="Quotations"
        Icon="radio_off.png"
        Style="{StaticResource BrowseTab1}">
        <ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="MainPage1" />
    </Tab>
    <Tab
        Title="Logout"
        Icon="radio_off.png"
        Style="{StaticResource BrowseTab2}">
        <ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="MainPage2" />
    </Tab>
    <Tab
        Title="Timer"
        Icon="radio_off.png"
        Style="{StaticResource BrowseTab3}">
        <ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="MainPage3" />
    </Tab>
</TabBar>

Link to public reproduction project repository

https://github.com/MK1985/MauiShellTabBarIssue

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android SDK 30-33

Did you find any workaround?

Didn't find any

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-shellShell Navigation, Routes, Tabs, Flyoutfixed-in-8.0.0-preview.1.7762Look for this fix in 8.0.0-preview.1.7762!p/1Work that is important, and has been scheduled for release in this or an upcoming sprintpartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withplatform/androidt/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions