Articles in this section
Category / Section

How to change the background and foreground of the selected tabs in the TabControlExt?

1 min read

To set the background and foreground for the selected tabs in the TabControlExt, the TabItemSelectedBackground and TabItemSelectedForeground property of the TabControlExt can be used. The same has been explained in the following code example:

XAML:

<Window x:Class="TabControl_sample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="_Grid">
<syncfusion:TabControlExt x:Name="_Tabcontrol" TabItemSelectedBackground="Brown" TabItemSelectedForeground="Yellow">
<syncfusion:TabItemExt Header="TabItem1"></syncfusion:TabItemExt>
<syncfusion:TabItemExt Header="TabItem2"></syncfusion:TabItemExt>
<syncfusion:TabItemExt Header="TabItem3"></syncfusion:TabItemExt>
<syncfusion:TabItemExt Header="TabItem4"></syncfusion:TabItemExt>
<syncfusion:TabItemExt Header="TabItem5"></syncfusion:TabItemExt>
</syncfusion:TabControlExt>
</Grid>
</Window>

 

C#:

using Syncfusion.Windows.Tools.Controls;
namespace TabControl_sample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
TabControlExt _TabControl = new TabControlExt();
_TabControl.TabItemSelectedBackground = Brushes.Brown;
_TabControl.TabItemSelectedForeground = Brushes.Yellow;
TabItemExt item1 = new TabItemExt();
item1.Header = "TabItem1";
TabItemExt item2 = new TabItemExt();
item2.Header = "TabItem2";
TabItemExt item3 = new TabItemExt();
item3.Header = "TabItem3";
TabItemExt item4 = new TabItemExt();
item4.Header = "TabItem4";
TabItemExt item5 = new TabItemExt();
item5.Header = "TabItem5";
_TabControl.Items.Add(item1);
_TabControl.Items.Add(item2);
_TabControl.Items.Add(item3);
_TabControl.Items.Add(item4);
_TabControl.Items.Add(item5);
_Grid.Children.Add(_TabControl);
}}}

 

 

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