Datasource refresh without closing the tree

6 posts, 0 answers
  1. Halász Levente
    Halász Levente avatar
    21 posts
    Member since:
    Feb 2010

    Posted 19 Aug 2010 Link to this post

    Hi,

    I'd like to use RadTreeViewList with RIA, but my problem is that whenever I refresh the datasource the whole tree collapses. Is there a way to avoid this collapsing.

    Thank you for your answer,

    Levente
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 19 Aug 2010 Link to this post

    Hi Halász Levente,

    Can you share more details about your refresh? Are you using a DomainDataSource and calling its Load() method?

    If you are assigning a new ItemsSource RadTreeListView will recreate its internal expand/collapse storage mechanisms so you will have to restore the expand/collapse state on your own. If you want to avoid a possible solution is to you can use a single observable collection as ItemsSource.

    Kind regards,
    Stefan Dobrev
    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. Halász Levente
    Halász Levente avatar
    21 posts
    Member since:
    Feb 2010

    Posted 19 Aug 2010 Link to this post

    Hi Stefan,

    I'm using DomainDataSource and I'm calling it's load method, with LoadBehavior.MergeIntoCurrent, so there is no reassignment of ItemsSource.

    I fount a possible work around, by writing a Behavior which binds the rows IsExpanded property to a list to store which elements were expanded before datasource refresh. The problem is that when I set IsExpanded back to true, after datasource refresh (to restore the initial tree) the treeviewlist doesn't render correctly (it has white areas instead of my structure). If I call ExpandHierarchyItem method, then it is OK. It also renders correctly if I resize the treeviewlist control.
  5. Halász Levente
    Halász Levente avatar
    21 posts
    Member since:
    Feb 2010

    Posted 19 Aug 2010 Link to this post

    I also noticed, that the treelistview collapses no matter what I do with the items source (even if I don't touch it) as soon it receives NotifyPropertyChanged.
  6. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 25 Aug 2010 Link to this post

    Hello Halász ,

    Looking at the internals of RadTreeListView it seems that whenever an item is removed from the source collection it is collapsed in the internal storage of the control, so an extra step to expand it back is necessary when this item comes back in the items source.

    Best wishes,
    Stefan Dobrev
    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
  7. Halász Levente
    Halász Levente avatar
    21 posts
    Member since:
    Feb 2010

    Posted 25 Aug 2010 Link to this post

    Thank you for your answer. The is unfortunate, however I rewrote the whole stuff and using ObservableCollection now as data source. It works OK.
Back to Top
DevCraft banner