RadPanelBar +DataTemplate

3 posts, 0 answers
  1. Daniel Varrin
    Daniel Varrin avatar
    18 posts
    Member since:
    Oct 2009

    Posted 15 Dec 2009 Link to this post


    I'm trying to use the RadPanelBar control for a binding source which contains a list of lists. I mean I have an object containing a list of sections, and each section contains a list of commands.

    I'm creating the control using this XAML:




    telerikNavigation:RadPanelBar ItemsSource="{Binding Path=Sections}"




        ItemTemplate="{StaticResource SectionsTemplate}"/>

    And I have the two following templates:









    DataTemplate x:Key="CommandsTemplate">









        <StackPanel Orientation="Vertical" Margin="5">









            <TextBlock Margin="2,6">









                <Hyperlink Command="{Binding Path=Command}">









                    <TextBlock Text="{Binding Path=DisplayName}" />


















































    DataTemplate x:Key="SectionsTemplate">









        <telerikNavigation:RadPanelBarItem ItemsSource="{Binding Path=Commands}" ItemTemplate="{StaticResource CommandsTemplate}">


















                <TextBlock Text="{Binding Path=SectionName}" />




























    The result is that there is like an other control in the sections bars, and I have to click on it (the arrow is not working) to see the list of commands, but instead of the commands being simple links, they appear as a RadPanelBar, with an arrow on the right which is doing nothing.

    What am I doing wrong?

    Best regards,
    Daniel Varrin


  2. Kiril Stanoev
    Kiril Stanoev avatar
    1512 posts

    Posted 19 Dec 2009 Link to this post

    Hello Daniel,

    The reason why you experience this issue is because you use a RadPanelItem inside a DataTemplate. For this scenario it is best to use a HierarchicalDataTemplate. I have modified your XAML and I have attached a sample project demonstrating how to use HierarchicalDataTemplate. Have a look at it and let me know if something needs further clarification. Additionally, you can take a look at this help article, as it explains how to use HierarchicalDataTemplate to populate a TreeView. The principle is the same since both RadPanelBar and RadTreeView are HeaderedItemsControls.

    Kiril Stanoev
    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.
  3. Daniel Varrin
    Daniel Varrin avatar
    18 posts
    Member since:
    Oct 2009

    Posted 19 Dec 2009 Link to this post

    Hi Kiril,

    Thank you very much for you answer and for the example. It is working all fine now with a HierarchicalDataTemplate :-)))

Back to Top