Databound RadTreeView doesn't reflect changes to underlying collection

3 posts, 1 answers
  1. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 27 Jul 2012 Link to this post

    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. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 27 Jul 2012 Link to this post

    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.

  3. DevCraft banner
  4. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 01 Aug 2012 Link to this post

    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
Back to Top