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

TransparentTheme example

1 Answer 42 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Chris Ingrao
Top achievements
Rank 1
Chris Ingrao asked on 15 Sep 2011, 07:15 AM
Hello,

Could you provide an example of the TabControl.xaml in the TransparentTheme that sets the unselected tabs foreground color to white but leaves the selected tabs black?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 20 Sep 2011, 01:55 PM
Hello Chris Ingrao,
The easiest way to achieve your desired behavior is to handle the SelectionChanged and in it set the foreground to the RadTabItems manually like this:
private void myTab_SelectionChanged(object sender, Telerik.Windows.Controls.RadSelectionChangedEventArgs e)
{
    var tab = sender as RadTabControl;
    for (int i = 0; i < tab.Items.Count; i++)
    {
        var container = tab.ItemContainerGenerator.ContainerFromIndex(i) as RadTabItem;
        if (container != null)
        {
            if (i != tab.SelectedIndex)
            {
                container.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                container.Foreground = new SolidColorBrush(Colors.Black);
            }
        }
    }
}
For further references could you please examine the attached project and if you have more questions feel free to ask.

Best wishes,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TabControl
Asked by
Chris Ingrao
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or