Preserve Expand / Collapsed

3 posts, 0 answers
  1. Matt Eland
    Matt Eland avatar
    24 posts
    Member since:
    Sep 2009

    Posted 28 Mar 2011 Link to this post

    I've got a scenario that requires me to change out a data collection. I'm trying to preserve the scroll position and set of Expanded / Collapsed rows with a TreeListView.

    The thought is something like this:

    1. Store current scroll position
    2. Store information on which items are collapsed / expanded
    3. Do my changes that cause a list refresh / scroll / expanded reset
    4. Expand all the items that should be expanded
    5. Scroll to the right place

    Ideally this should present a relatively accurate and seamless experience to the user.

    I can work things out with the scrolling, but I can't find a good way of determining if a given RadTreeListView thinks that a particular row is expanded or collapsed. I can get events on expanded changed / changing, but I don't know what value its changed / changing to, so that's fairly useless for my purposes.

    Really, I just want to loop through my collection of items and ask the grid if that row is expanded / collapsed. The particular row shouldn't need to be visible on the grid or anything.

    Unfortunately, I can't find a way of doing this.
  2. Vlad
    Vlad avatar
    11100 posts

    Posted 30 Mar 2011 Link to this post


    I believe that you can use RowIsExpandedChanged event to check when the row is expanded or collapsed. The data item bound to this row can be referenced using DataContext property of the row. 

    All the best,
    the Telerik team
  3. DevCraft R3 2016 release webinar banner
  4. Matt Eland
    Matt Eland avatar
    24 posts
    Member since:
    Sep 2009

    Posted 30 Mar 2011 Link to this post

    Yeah. I discovered I could cast e.Row to a TreeViewListRow (or similar name) and look at the IsExpanded property on that object, but typically with changed / changing events the NewValue and OldValue are presented in the event args so you know what it's changed / changing to / from so that's what confused me there.
Back to Top