Skip to content

TabbedPage doesn't change icon colour #23174

@richaplinvs

Description

@richaplinvs

Description

The TabbedPage doesn't change the icon colour as the tabs are selected/unselected. The title text changes ok.

Using a PNG, instead of an Icon works too, and the colour changes in sync with the title text.

This was working on Xamarin.Forms and works on Android .NET Maui with some tweaks.

Steps to Reproduce

Create a new maui app.
Add fontawesome
Add a tabbed page with content and set the title and icon for each.
See reproduction project for details.

Link to public reproduction project repository

https://github.com/richaplinvs/reproduction-projects/tree/main/maui/TabbedSelectionIssue

Version with bug

9.0.0-preview.4.10690

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOS 17.4, Android Api 33

Did you find any workaround?

On Android changing the position of the toolbar:

On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

or tab colours:

UnselectedTabColor = Colors.Red;
SelectedTabColor = Colors.Orange;
BarBackgroundColor = Colors.HotPink;

On iOS use the OnAppearing/OnDisappearing in each of the tabs content page to set the colour. This requires creating a new instance of FontImageSource each time because the Color property cannot be set on it's own.

var IconImage = new FontImageSource() { FontFamily = "FontAwesomeProSolid", Glyph = FontAwesome.FontAwesomeIcons.Pencil, Size = 25, Color = Colors.Gray };         
if(selectedTab)
{
    IconImage.Color = Colors.Red;
}
IconImageSource = IconImage;

Relevant log output

No response

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions