DataBinding with Custom Tabs

3 posts, 1 answers
  1. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 26 Jul 2011 Link to this post

    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}">

    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. Answer
    Kiril Stanoev
    Kiril Stanoev avatar
    1508 posts

    Posted 27 Jul 2011 Link to this post

    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.

    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!

  3. DevCraft R3 2016 release webinar banner
  4. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 27 Jul 2011 Link to this post

    This looks exactly like what I want to accomplish. Thanks!
Back to Top