Posted 8 June 2023, 8:15 pm EST
Hello, I’m trying to modify the color of a selected TabItem upon selection. Could you guide me through this process? I appreciate your help in advance.
Forums Home / ComponentOne / WPF Edition
Posted by: ronen.hong on 8 June 2023, 8:15 pm EST
Posted 8 June 2023, 8:15 pm EST
Hello, I’m trying to modify the color of a selected TabItem upon selection. Could you guide me through this process? I appreciate your help in advance.
Posted 11 June 2023, 3:20 pm EST
Hi kyungsoo,
You can set the background color of the selected header tab by setting the style defined to C1TabControl’s SelectedTabHeaderStyle as shown in the following code:
//defining the style
<Style x:Key="selectedTabHeaderStyle" TargetType="c1:C1TabItemPresenter">
<Setter Property="Background" Value="Red"/>
</Style>
//using the style
<c1:C1TabControl Name="tabControl" SelectedIndex="0" SelectedTabHeaderStyle="{StaticResource selectedTabHeaderStyle}">
Kindly refer to the attached sample for full implementation. (See SelectedTabItemColor.zip)
Thanks & Regards,
Aastha