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

ItemTemplate in version 1103?

4 Answers 77 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 2
Nathan asked on 04 Nov 2009, 10:51 PM
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

4 Answers, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 2
answered on 05 Nov 2009, 05:42 PM
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!
0
Miroslav
Telerik team
answered on 09 Nov 2009, 07:52 PM
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.
0
Miroslav
Telerik team
answered on 10 Nov 2009, 12:09 PM
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.
0
Nathan
Top achievements
Rank 2
answered on 10 Nov 2009, 08:27 PM
Thanks for the explanation - that makes sense. Keep up the good work on these controls! : )
Tags
TabControl
Asked by
Nathan
Top achievements
Rank 2
Answers by
Nathan
Top achievements
Rank 2
Miroslav
Telerik team
Share this question
or