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

Databound RadTreeView doesn't reflect changes to underlying collection

2 Answers 84 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 27 Jul 2012, 10:18 AM
Good morning,

I've succesfully managed to build a databound, hierarchical combination of a RadBreadCrumb and a RadTreeView, both are bound to the same data structure. When I make changes to the property of an item (e.g. set its state to "Error" so that it shows a warning icon), they are instantly updated in both controls. Nice.
In real life, the data will intermittently be sent in from a webservice. Therefore, I need to dynamically add and remove items to or from the data structure, so that changes will be shown instantly. I thought that would be achieved by using an ObservableCollection as datasource, which it is. It seems that I am missing something important. I made a sample application that shows the problem - can somebody tell me how I can add or remove items by clicking the button?

I uploaded the zipped project here.

Thanks alot!

Cheers,
Robert

2 Answers, 1 is accepted

Sort by
0
Accepted
Zarko
Telerik team
answered on 27 Jul 2012, 02:45 PM
Hi Robert,
The problem is in the HierarchyConverter - you return new ObservaleCollections and you add items to the old collection. A possible workaround is to handle the CollectionChanged event of your old collection and manually add the new items to the new collections.
I've updated and reattached your project so could you please examine it and if you have further questions please feel free to ask.

All the best,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Robert
Top achievements
Rank 1
answered on 01 Aug 2012, 07:14 AM
Hi Zarko,

thank you for your fast and professional support, it now works exactly the way I need it. Keep up the good work - it's worth every cent :-)

Best regards,
Robert
Tags
TreeView
Asked by
Robert
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Robert
Top achievements
Rank 1
Share this question
or