Setting up data structure for bindings

4 posts, 0 answers
  1. Lawrence
    Lawrence avatar
    14 posts
    Member since:
    Mar 2009

    Posted 05 Jul 2010 Link to this post

    I am lost on how to setup the treelistview with regard to lazy loading hierarchial collections.  As an example I would like the treelistview("TLV") to be bound to a collection of PhotoAlbums in the viewmodel.  Each PhotoAlbum has a Collection<Photo> Photos property, and each Photo has a Collection<Tag> property.  I would like to use the TLV to represent this in a hierarchial manner.  I am unclear on how to set this up using the ChildTableDefinitions.  Moreover, the RowLoaded event does not pass a row that has a clear mechanism of displaying the expander control similar to the treeview  and allowing you to catch the expanded event to load the data (similar to TreeView AllowLazyLoading).  I only saw a single readonly property for HasHierarchy. 

    I understand the TLV is not "officially released" so I wasnt able to find any docs on it, however if you could offer a sample app of how to use it in the above scenario, I know it would likely benefit many other besides myself and further encourage adoption.

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Jul 2010 Link to this post

    Hello Lawrence,

     The easiest way will be to implement this at your model level - directly in these properties getters. You can check this blog post (related to RadGridView) for more info about such approach.

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Lawrence
    Lawrence avatar
    14 posts
    Member since:
    Mar 2009

    Posted 05 Jul 2010 Link to this post

    So that article indicates how I might implement lazy loading, but how do I set up the hierarchial structure to work with the TLV?  What I have below does not seem to work:

    <telerik:RadTreeListView
                infra:BindingViewModel.BindingObject="{Binding}"
                x:Name="RadTreeListView1"
                AutoGenerateColumns="False"
                IsReadOnly="True"
                DataLoadMode="Asynchronous"
                ItemsSource={Binding PhotoAlbums}
                SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                IsSynchronizedWithCurrentItem="true">
                <telerik:RadTreeListView.ChildTableDefinitions>
                    <telerik:TreeListViewTableDefinition />
                    <telerik:TreeListViewTableDefinition
                        ItemsSource="{Binding Photos}">
                        <telerik:TreeListViewTableDefinition.ChildTableDefinitions>
                            <telerik:TreeListViewTableDefinition
                                ItemsSource="{Binding Tags}" />
                        </telerik:TreeListViewTableDefinition.ChildTableDefinitions>
                    </telerik:TreeListViewTableDefinition>
               </telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:RadTreeListView.Columns>
                    <telerik:GridViewDataColumn
                        MinWidth="200"
                        DataMemberBinding="{Binding}"
                        Header="Name"
                        CellTemplateSelector="{StaticResource ItemTemplateSelector}"/>
                    <telerik:GridViewDataColumn
                        MinWidth="100"
                        DataMemberBinding="{Binding CreatedDate}"
                        Header="CreatedDate" />
                </telerik:RadTreeListView.Columns>
            </telerik:RadTreeListView>-->
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 Jul 2010 Link to this post

    Hello Lawrence,

    I've just noticed that you have heterogeneous data in your case. Generally RadTreeListView can be used to display homogeneous data (all hierarchy levels will have same columns/properties) - in case of heterogeneous you can use RadGridView.

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top