This is a migrated thread and some comments may be shown as answers.

RadTabControl - Tab Item - Style Trigger

1 Answer 563 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
yenkay
Top achievements
Rank 2
yenkay asked on 16 Mar 2020, 12:40 PM

I'm trying to modify the tab control's header background and border with the style triggers when the tab is selected but nothing seems to be working and the code also doesn't shows any error message.

Below is the XAML of the control:

<telerik:RadTabControl x:Name="presetTab" Grid.Row="1" Margin="0,5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 
   ScrollMode="Item" HeaderBackground="#F7F3F2"
   ItemsSource="{Binding Source={StaticResource DataSource}, Path=Tabs}"
   ContentTemplateSelector="{StaticResource ContentSelector}">
<telerik:RadTabControl.ItemContainerStyle>
<Style TargetType="telerik:RadTabItem">
<Setter Property="BorderBrush" Value="#BCBCBC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HeaderForeground" Value="Black"/>
<Style.Triggers>
<Trigger Property="telerik:RadTabItem.IsSelected" Value="True">
<Setter Property="BorderBrush" Value="#BCBCBC"/>

<Setter Property="BorderThickness" Value="1"/>

</Trigger>
</Style.Triggers>
</Style>
</telerik:RadTabControl.ItemContainerStyle>
</telerik:RadTabControl>

I need to apply the same border style as normal when the tab is selected and the background color will be different.

I tried the IsSelected property both in Data Trigger and in Style Trigger but both is not working. What am I doing wrong.

Regards,

Karthik N

1 Answer, 1 is accepted

Sort by
0
Vicky
Telerik team
answered on 17 Mar 2020, 03:01 PM

Hi Karthik,

Thank you for the provided resources - they were of great help.

If I correctly understand, you need to have the same border style for a RadTabItem, irregardless of its selection state. A possible reason why the Style triggers are not leading to the desired result is the applied theme. If the default Telerik theme is used (OfficeBlack), this border style depends also on the VisualStates and the additional Border elements for the selected state of the control inside its template.

Could you please share which theme are you using for your application and the preferred mechanism for setting it?

In the meantime, I prepared a sample project for your convenience, which demonstrates the recommended approach to achieve the desired look and feel when using the OfficeBlack theme. Please, give it a try and let me know if it helps.

Regards,
Vicky
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TabControl
Asked by
yenkay
Top achievements
Rank 2
Answers by
Vicky
Telerik team
Share this question
or