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

Background color of selected RadTabItem

5 Answers 282 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Chris Thierry
Top achievements
Rank 1
Chris Thierry asked on 11 Feb 2011, 04:21 PM
Hi, I was trying to change the back color of selected tabitem in Silverligh 4.0 using Telerik RadControls Q3 SP1, I saw a couple of examples with lot of lines of code for doing this.
I just want to change the background color,  is there any property like SelectedItemBackgroundColor?, I don't want special effects, just a simple color. I can use property Background but when there is only one item, my Background color doesn't appears! because I have only one item.

Thank you.

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 15 Feb 2011, 08:07 PM
Hi Chris Thierry,

There is no such property. You can edit the default style of the RadTabItem and apply it to whichever element you wish , even if it is the only one in the ItemsCollection. You can also create a style and bind the Background of the RadtabItem  to the IsSelected Property via converter.
Feel free to ask if you need more info or help on this.

All the best,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Chris Thierry
Top achievements
Rank 1
answered on 17 Feb 2011, 06:06 PM
Could you please provide an example?
Thank you.
0
Petar Mladenov
Telerik team
answered on 22 Feb 2011, 04:41 PM
Hello Chris Thierry,

Please check out the attached  sample where a basic approach to your request is realized.
Basically, you have to play with the MouseOverVisual Border in the ControlTemplate of the RadTabItem.
Do not hesitate to ask if you need further assistance on this.

Regards,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
dh
Top achievements
Rank 1
answered on 25 Aug 2011, 11:27 PM
We would like to create a tab control where each tab has a different background color that is maintained when the tab is selected.  Is the solution to this to create a different control template for each tab?  Can this be done once and reused between different tabs in different tab control instances?  Providing a different control template per tab is not very maintainable or scalable.  Having a SelectedBackground property taking a brush would provide the needed flexibility.

Also, a previous post mentioned binding the Background property to the IsSelected property using a converter, but I had no luck producing the desired behavior.  Providing a different converter per tab would be sufficient if you could show us an example of this method working.
0
Tina Stancheva
Telerik team
answered on 31 Aug 2011, 02:19 PM
Hello Dan,

In your case I'd suggest you to bind the Background property of the RadTabItem to a business property from your view model. Then you can edit the ControlTemplate of the RadTabItem and bind the Background property of the SelectionVisual Border to the RadTabItem Background property as well. This way the business color property will control the background of the TabItems' Headers in normal and selected states.

I attached a sample project to get you started.

Regards,
Tina Stancheva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
TabControl
Asked by
Chris Thierry
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Chris Thierry
Top achievements
Rank 1
dh
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or