Articles in this section
Category / Section

How to Change Tab Header Image Color in .NET MAUI Tab View?

5 mins read

In .NET MAUI, customizing your TabView headers with font icons can greatly enhance your application’s visual appeal and user experience. You can further improve interactivity by dynamically changing icon colors when a tab is selected or unselected.

This article explains how to style the Syncfusion .NET MAUI TabView headers using custom font icons and visual states.

Step 1: Define the Tab View and Style Tab Items in XAML:

In your XAML file, define the SfTabView and include multiple SfTabItem elements. Each tab item should have a Header and a FontImageSource as its icon.

To enable dynamic styling of the icons, bind the Color property of FontImageSource to the TextColor property of the respective SfTabItem using {x:Reference} binding. Then, use VisualStateManager to manage the color transitions for selected and unselected states.

XAML

 <ContentPage.Resources>
     <Style TargetType="tabView:SfTabItem">
         <Setter Property="VisualStateManager.VisualStateGroups">
             <VisualStateGroupList>
                 <VisualStateGroup>
                     <VisualState x:Name="NormalFilled" >
                         <VisualState.Setters>
                             <Setter Property="TextColor" Value="#000000" />
                         </VisualState.Setters>
                     </VisualState>
                     <VisualState x:Name="SelectedFilled">
                         <VisualState.Setters>
                             <Setter Property="TextColor" Value="Red" />
                         </VisualState.Setters>
                     </VisualState>
                 </VisualStateGroup>
             </VisualStateGroupList>
         </Setter>
     </Style>
 </ContentPage.Resources>


 <tabView:SfTabView x:Name="tabView"  TabWidthMode="Default" IndicatorPlacement="Fill" TabBarHeight="70" >
     <tabView:SfTabView.Items>
         <tabView:SfTabItem Header="Photos" x:Name="photosTab" FontFamily="SegmentIcon"  FontSize="25">
             <tabView:SfTabItem.ImageSource>
                 <FontImageSource Glyph=""
               Color="{Binding Source={x:Reference photosTab},Path=TextColor}"
           FontFamily="PhotoGallery"/>
             </tabView:SfTabItem.ImageSource>
             <tabView:SfTabItem.Content>
                 <Label Text="Photos Content" VerticalOptions="Center" HorizontalOptions="Center"></Label>
             </tabView:SfTabItem.Content>
         </tabView:SfTabItem>

         <tabView:SfTabItem Header="Albumns" x:Name="albumsTab" FontFamily="SegmentIcon"  FontSize="25" >
             <tabView:SfTabItem.ImageSource>
                 <FontImageSource Glyph=""
               Color="{Binding Source={x:Reference albumsTab},Path=TextColor}"
           FontFamily="PhotoGallery"/>
             </tabView:SfTabItem.ImageSource>
             <tabView:SfTabItem.Content>
                 <Label Text="Albumns Content" VerticalOptions="Center" HorizontalOptions="Center"></Label>
             </tabView:SfTabItem.Content>
         </tabView:SfTabItem>

         <tabView:SfTabItem Header="Contacts" x:Name="favouritesTab" FontFamily="SegmentIcon" FontSize="25">
             <tabView:SfTabItem.ImageSource>
                 <FontImageSource Glyph=""
                                  Color="{Binding Source={x:Reference favouritesTab},Path=TextColor}"
                                  FontFamily="PhotoGallery"/>   
             </tabView:SfTabItem.ImageSource>
             <tabView:SfTabItem.Content>
                 <Label Text="Fovourites Content" HorizontalOptions="Center" VerticalOptions="Center"></Label>
             </tabView:SfTabItem.Content>
         </tabView:SfTabItem>
     </tabView:SfTabView.Items>
 </tabView:SfTabView>

Output

@(Embed){ScreenRecording2025-05-27155627-ezgifcom-video-to-gif-converter.gif}

Conclusion

I hope you enjoyed learning how to change the tab header image color in .NET MAUI Tab View.

You can refer to our .NET MAUI Tab View feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Tab View documentation to understand how to present and manipulate data.

You can check out our .NET MAUI components from the License and Downloads page for current customers. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Tab View and other .NET MAUI components.

Please let us know in the comments section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied