2 posts, 0 answers
  1. Ali Rafiee
    Ali Rafiee avatar
    23 posts
    Member since:
    May 2010

    Posted 07 Feb 2012 Link to this post

    I'm trying to display a list of items and their children in a TreeListView.

    The children are not the same type as parent items, so I looked into useing a HierarchicalDataTemplate, but I can't get it to work.

    I did a little digging and saw some posts that said TreeListView does not support parent child relationships of different types, but then saw another post where someone had defined one, but I can't get it to work. (http://www.telerik.com/community/forums/silverlight/treelist/silverlight-3-radtreelistview-hierarchicaldatatemplate-question.aspx)

    Does it or doesn't support HierarchicalDataTemplate?

    What I have is this:

    public class Parent
       public string Name {get; set;}
       public List<Child> Items { get; set; }
    public class Child
       public string ItemRTF { get; set; }

         <telerik:HierarchicalDataTemplate x:Key="ChildTemplate">
             <telerik:RadRichTextBox Background="Yellow" IsReadOnly="true" />
         <telerik:HierarchicalDataTemplate x:Key="ParentTemplate" ItemTemplate="{StaticResource ChildTemplate}" ItemsSource="{Binding Items}">
             <sdk:Label Background="Green"  Content="{Binding Name}"/>
     <Grid x:Name="LayoutRoot" Background="White">
         <telerik:RadTreeListView Margin="12,12,12,37" Name="myTreeListView" ItemTemplate="{StaticResource ParentTemplate}" AutoGenerateColumns="False">
                 <telerik:GridViewColumn Width="*"/>

  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 08 Feb 2012 Link to this post


     The RadTreeListView displays the data in a tree view manner in one and the same table.
    It could be used for displaying of homogeneous data or data that has the same properties. If the data is heterogamous, the the TreeListView will display only the properties with the same name. In order to display the hierarchy data, you should use the ChildTableDefinitions property. This property should have the same name at each level of the hierarchy. As the hierarchical data in the TreeListView is displayed in one and the same table, each level of the hierarchy will share one and the same set of columns. This means that your data should provide the needed members at each level of the hierarchy.

    Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft R3 2016 release webinar banner
Back to Top