Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remember expanded rows on collapse and re-expand

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
jkempner



Joined: 03 Sep 2008
Posts: 17

PostPosted: Fri May 04, 2012 6:58 pm    Post subject: Remember expanded rows on collapse and re-expand Reply with quote

The standard behavior in a Windows Forms tree control is to remember which sub-nodes were expanded when a node is collapsed and then re-expanded. The default behavior in VirtualTree (I'm using 3.15) appears to be that all children, grandchildren, etc. get collapsed when their parent is collapsed. Is there a way to get around this, so that when I collapse and then re-expand a row, the children of that row that were expanded before their parent was collpased are still expanded?

For what it's worth, I'm using programmatic data binding in the control where I see this behavior.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat May 05, 2012 12:43 am    Post subject: Reply with quote

Virtual tree will also remember the expanded sub nodes and rexpand them. You can see this behaviour by running the Simple Tree sample.

I think the problem is that your GetChildren method is probably returning a new set of objects each time it is called. Virtual Tree saves references to the data objects that have been been expanded by the user and then will look for rows corresponding to these items to try and re-expand them. If you have actually created new objects then these won't match and the object won't be expanded.

Normally you want to implement some form of caching of your data objects so that you aren't creating new data objects if there already was an existing object. This also avoids possible problems with aliasing - where Virtual Tree holds a reference to one version of an object and your application has a reference to another object - which represents the same data.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group