How to customize the border for tab header area in .NET MAUI Tab View?
This article explains how to customize the border for the tab header area in .NET MAUI Tab View. You can achieve this by using the following built-in properties of the SfTabView:
- TabBarBorderColor - sets the border color
- TabBarBorderThickness - sets the border thickness
- TabBarCornerRadius - sets the corner radius of the tab bar’s border
MainPage.Xaml
<tabView:SfTabView TabBarBorderColor="#2196F3" TabBarBorderThickness="3" TabBarCornerRadius="24"
IndicatorBackground="#E3F2FD" IndicatorPlacement="Fill"
TabBarPlacement="Bottom">
<tabView:TabItemCollection>
<tabView:SfTabItem Header="Library">
<Label Text="Library Content" HorizontalOptions="Center" VerticalOptions="Center"/>
</tabView:SfTabItem>
<tabView:SfTabItem Header="Browse">
<Label Text="Browse Content" HorizontalOptions="Center" VerticalOptions="Center"/>
</tabView:SfTabItem>
<tabView:SfTabItem Header="Playlists">
<Label Text="Playlist Content" HorizontalOptions="Center" VerticalOptions="Center"/>
</tabView:SfTabItem>
</tabView:TabItemCollection>
</tabView:SfTabView>
MainPage.Xaml.cs
SfTabView tabView = new SfTabView
{
TabBarBorderColor = Color.FromArgb("#2196F3"),
TabBarBorderThickness = 3,
TabBarCornerRadius = 24,
IndicatorBackground = Color.FromArgb("#E3F2FD"),
IndicatorPlacement = TabIndicatorPlacement.Fill,
TabBarPlacement = TabBarPlacement.Bottom
};
Output:
You can download the complete sample from GitHub.
Conclusion
Hope you enjoyed learning how to apply a gradient background to each tab header in .NET MAUI TabView.
Refer to our .NET MAUI Tab View feature tour page to learn about its other groundbreaking feature representations. You can explore our .NET MAUI Tab View documentation to understand how to present and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!