ItemContainerStyle not working

2 posts, 0 answers
  1. Heiko
    Heiko avatar
    153 posts
    Member since:
    Oct 2012

    Posted 22 Mar 2012 Link to this post

    Hi everyone!

    We are just evaluating the actual Q1.2012 Version of Silverlight Controls together with SL5 and ran into a problem using RadTabControl and its ItemContainerStyle. What was working in an older version of this control is no longer working in the actual version.
    We created a very simple Style (just for testing purposes):
        <Style x:Key="ClosableStyle" TargetType="telerik:RadTabItem">
            <Setter Property="HeaderTemplate">
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            <ContentControl Content="Hello, World!" />

    Then apply this to the RadTabControl like this:
        <telerik:RadTabControl Height="200" ItemContainerStyle="{StaticResource ClosableStyle}">

    The result is: nothing is shown in the tabheader, it should display "Hello, world!". We tried the same Style with an older version of RadTabControl (2010.3, one of your examples out of this forum) and this one is definetely working.

    Any help is very appreciated!
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 27 Mar 2012 Link to this post

    Hi Neils,

    I am not sure how you've managed to get this working in previous version but basically the ItemContainerStyle property is used to apply a style to all RadTabItem containers when the RadTabControl ItemsSource collection contains a collection of business items. This is why the ItemContainerStyle property is useful in databinding scenarios. But when you define the RadTabItems declaratively in xaml you can define the Header, Content and the overall style of each tab in xaml and this is why the ItemContainerStyle property in such scenarios cannot be used.

    I attached a sample project demonstrating a common scenario in which the ItemContainerStyle property is used to set the HeaderTemplate of the tab items. I hope it helps.

    Kind regards,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top