Background color of selected RadTabItem

6 posts, 0 answers
  1. Chris Thierry
    Chris Thierry avatar
    138 posts
    Member since:
    Jun 2010

    Posted 11 Feb 2011 Link to this post

    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.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Feb 2011 Link to this post

    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>>
  3. DevCraft banner
  4. Chris Thierry
    Chris Thierry avatar
    138 posts
    Member since:
    Jun 2010

    Posted 17 Feb 2011 Link to this post

    Could you please provide an example?
    Thank you.
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Feb 2011 Link to this post

    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!
  6. dh
    dh avatar
    8 posts
    Member since:
    Mar 2006

    Posted 25 Aug 2011 Link to this post

    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.
  7. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 31 Aug 2011 Link to this post

    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 >>

Back to Top
DevCraft banner