How to Customize Badge Appearance in .NET MAUI Tab View?
This article explains how to customize the badge
appearance in the .NET MAUI Tab View.
To fully customize the badge in the Tab View
, you can set the Type property in BadgeSettings to None. This allows you to customize the badge beyond predefined styles by explicitly specifying properties such as Background and TextColor.
<ContentPage ...
xmlns:core="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"
xmlns:tabView="clr-namespace:Syncfusion.Maui.TabView;assembly=Syncfusion.Maui.TabView">
<tabView:SfTabView x:Name="tabView">
<tabView:SfTabView.Items>
<tabView:SfTabItem Header="Call" BadgeText="3">
<tabView:SfTabItem.BadgeSettings>
<core:BadgeSettings Type="None" Background="GreenYellow" TextColor="Red" TextPadding="3"/>
</tabView:SfTabItem.BadgeSettings>
<tabView:SfTabItem.Content>
<ListView RowHeight="50">
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>James</x:String>
<x:String>Richard</x:String>
<x:String>Michael</x:String>
<x:String>Alex</x:String>
<x:String>Clara</x:String>
</x:Array>
</ListView.ItemsSource>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Margin="10,5">
<Label VerticalOptions="Start"
HorizontalOptions="Start"
TextColor="#666666"
FontSize="16"
Text="{Binding}" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
</tabView:SfTabView.Items>
</tabView:SfTabView>
</ContentPage>
By setting Type to None in BadgeSettings
, you gain complete control over the appearance of the badge in Tab View
.
Output
Download the complete sample from GitHub.
Conclusion
I hope you enjoyed learning how to customize badge appearance in .NET MAUI Tab View.
You can refer to our .NET MAUI Tab View feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our .NET MAUI Tab View example to understand how to create and manipulate data.
For current customers, our components are available on the License and Download page. If you are new to Syncfusion®, try our 30-day free trial to try our other controls.
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!