Changing TreeListViewTableDefinition's ItemsSource

2 posts, 0 answers
  1. Bob
    Bob avatar
    9 posts
    Member since:
    Nov 2010

    Posted 11 Oct 2011 Link to this post


    I have a typical tree list setup:

            <telerik:RadTreeListView ItemsSource="{Binding OuterList}">
                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding MiddleList}">
                            <telerik:TreeListViewTableDefinition ItemsSource="{Binding InnerList}"/>


    Initially, OuterList, MiddleList and InnerList were all ObservableCollections. But when I'm adding or removing 100s of items from a list, ObservableCollection fires an event for each change and a huge amount of time (minutes) gets used up in RadTreeListView, apparently figuring out the new UI layout.

    So I decided to make MiddleList a List<MyObject> property. I'd calculate the new contents of MiddleList elsewhere, then I'd set the MiddleList property to the new list. Changing that property would trigger an INotifyPropertyChanged.PropertyChanged event. All the changes would become visible to RadTreeListView in a single event.

    Unfortunately, RadTreeListView doesn't seem to respond to a PropertyChanged event that changes the TreeListViewTableDefinition's ItemsSource. When I set MiddleList to a new value, the list of displayed items does not change.

    Is there a way to force RadTreeListView to re-load its table definitions? Is there another approach I should be taking?

       Bob Alexander
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 14 Oct 2011 Link to this post

    Hello Bob,

     You could use a RadObservableCollection instead of List. This collection allows you to suspend or resume its notifications. So you could suspend your notifications when you will add or remove many items.

    This will solve your problem. 

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top