property of the RadTabItem
is exposed to allow you to apply a different DataTemplates
to a databound RadTabItem
. This property is mostly used in MVVM scenarios where the RadTabControl ItemsSource
is bound to a business collection.
Also, when you create a custom DataTemplateSelector,
you don't have to apply it only to certain items since the main purpose of this class is to allow you to evaluate each RadTabItem
and apply to it a HeaderTemplate
based on that evaluation. So instead of setting a DataTemplateSelctor
to a few items, you can apply it to all and implement custom logic to choose different templates for each item. And for such scenarios, you can take advantage of the RadTabControl.ItemTemplateSelector
property. It applies different HeaderTemplates
to the RadTabControl
Items - the same as the HeaderTemplateSelector
Keeping the above in mind, you can implement your scenario by binding the RadTabControl
to a business collection and setting its ItemTemplateSelector
property. In the custom HeaderSelector
class you can implement custom logic to choose different templates for the items based on your business logic. Also, when you need to add new items to the RadTabControl
, you can simply add new business items to the business collection.
However, if you need to create RadTabItems
in code-behind, then you don't have to use the HeadertemplateSelector
since you don't have to set any bindings to the Header
property. You can set the Header
in the code.
I attached a sample project illustrating a scenario where the RadTabControl is data bound to a business collection and the ItemTemplateSelector
property is used to define different HeaderTemplates
for the RadTabItems
. Please have a look at it and let us know if it helps or if you need more info.
All the best,
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!