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

Setting up data structure for bindings

3 Answers 118 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 05 Jul 2010, 07:30 AM
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.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Jul 2010, 08:12 AM
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
0
Lawrence
Top achievements
Rank 1
answered on 05 Jul 2010, 05:54 PM

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>-->
0
Vlad
Telerik team
answered on 09 Jul 2010, 07:33 AM
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
Tags
TreeListView
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Lawrence
Top achievements
Rank 1
Share this question
or