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

DataBinding with Custom Tabs

2 Answers 114 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
digitall
Top achievements
Rank 1
digitall asked on 27 Jul 2011, 02:31 AM
I have a databound tabstrip where the tabs come from one set of data and the content of the tabs is a DataTemplate with a ListView inside. Is there a way to have this scenario but also add additional tabs for items that will not be bound to that DataTemplate?

My tabstrip XAML looks like this:
<telerik:RadTabControl telerik:Theming.Theme="Windows7" BackgroundVisibility="Collapsed" TabStripPlacement="Left" TabOrientation="Vertical" DisplayMemberPath="Name"
                                           ItemsSource="{Binding ReviewCategoryModels}" ContentTemplate="{StaticResource ReviewSectionDetailTemplate}" Align="Right" ItemContainerStyle="{StaticResource ReviewCategoryTabStyle}" />

And then in UserControl.Resources I have the following:
<DataTemplate x:Key="ReviewSectionDetailTemplate">
<ListView x:Name="items" ItemsSource="{Binding Items}" AlternationCount="2" MinWidth="550" Style="{StaticResource ReviewItemListView}">
[...]
</ListView>
</DataTemplate>

So I want to use this setup but then add an additional tab (or two, etc.) that do NOT use this DataTemplate. My app is based off the MVVM pattern so sticking inside the guidelines of that is preferable (though not required).

Is this possible?

2 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 27 Jul 2011, 01:53 PM
Hi Digitall,

Instead of using a ContentTemplate, you can use the ContentTemplateSelector property and choose what king of ContentTemplate to select. Please take a look at the attached project which demonstrates how to use a ContentTemplateSelector. Let me know if it helps.

Greetings,
Kiril Stanoev
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!

0
digitall
Top achievements
Rank 1
answered on 27 Jul 2011, 07:19 PM
This looks exactly like what I want to accomplish. Thanks!
Tags
TabControl
Asked by
digitall
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
digitall
Top achievements
Rank 1
Share this question
or