ItemTemplate in version 1103?

5 posts, 0 answers
  1. Nathan
    Nathan avatar
    24 posts
    Member since:
    Sep 2009

    Posted 04 Nov 2009 Link to this post

    Hello,

    We upgraded our controls to the latest version today and suddenly have a problem with the tab item template.

    We have some code to style the tab headers as well as the tab items (all databound), but since the update our tab items just show the classic string representation of the class we are binding to rather than the actual visual objects contained in our template.

    I will paraphrase the code since it's quite lengthy:

    <RadTabControl ItemSource={Binding Tabs}>

    <RadTabControl.ItemTemplate>
    <DataTemplate>
    <!-- Another user control bound to a list of panes to show within each tab --!>
    </DataTemplate>
    </RadTablControl.ItemTemplate>

    <RadTabConrol.ItemContainerStyle>
    <!-- Data Template to show the name of our tab, etc --!>
    </RadTabConrol.ItemContainerStyle>
    </RadTabControl>

    This was all working beautifully yesterday - did the itemtemplate get replaced by something else?

    Any help would be appreciated!

    Nate
  2. Nathan
    Nathan avatar
    24 posts
    Member since:
    Sep 2009

    Posted 05 Nov 2009 Link to this post

    FYI we did find a work around for this issue.

    If we define the contenttemplate in the itemcontainer style it does work (paraphrased code):
    <RadTabControl>
    <RadTabControl.ItemContainerStyle>
    <Style TargetType=RadTTabItem>
    <Setter.Value>
    <DataTemplate>
    <!-- The control that will host our panes --!>
    ...close off all the tags
    <Setter Property="HeaderTemplate">
    ... close off all the tags
    </RadTabControl>

    To me these 2 methods should be equivalent? i.e. setting the content template of the container vs. setting the item template directly should amount to the same thing but obviously I don't know the underlying implementation of the controls.

    Hopefully this post helps someone out!

    If anyone from Telerik could explain this difference to me that would be great just for the learning experience.

    Thanks!
  3. DevCraft banner
  4. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 09 Nov 2009 Link to this post

    Hello Nathan,

    This issue is a result of changes in the telerik ItemsControl class. We made sure its behavior is almost exactly the same as the ItemsControl in WPF. Before we used to set the ItemTemplate as ContentTemplate of the RadTabItems and it worked differently in WPF.

    As a result of making the two ItemsControls work the same, it meant that the ContentTemplate will not be assignable from the TabControl easily. This is why we added the two properties: ContentTemplate and ContentTemplateSelector.

    This way you can use the ItemTemplate property to set how the Headers will look and the ContentTemplate property to set how the content will look. In your case you can remove the ItemContainerStyle and use the two properties directly.

    I will write an article for the changes we have introduced and I will post the link here once it is ready, so that the changes will be more transparent.

    Kind regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 10 Nov 2009 Link to this post

    Hi Nathan,

    I created a Knowledge Base article that describes this change:

    http://www.telerik.com/support/kb/silverlight/tabcontrol/tabcontrol-2009-q2-to-2009-q3-changes.aspx

    Thank you again for your feedback.

    Best wishes,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Nathan
    Nathan avatar
    24 posts
    Member since:
    Sep 2009

    Posted 10 Nov 2009 Link to this post

    Thanks for the explanation - that makes sense. Keep up the good work on these controls! : )
Back to Top
DevCraft banner