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 

Generating children when needed...

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



Joined: 19 Jan 2007
Posts: 44

PostPosted: Tue Dec 07, 2010 1:49 am    Post subject: Generating children when needed... Reply with quote

I am using VT 4.0.0, and set Data Binding as Object Binding (and set ChildProperty) in Infralution Virtual Tree Editor. Under the root node (hidden), there are few nodes, but each node contains huge amount of child nodes, and those nodes are created on demand (when the parent node is expanding)....


Code:

IList<myNode> Children
{
  get
  {
     if(_children == null)
     {
        if(expanded)
        {
            // generating thousands child nodes and assign into _children list
            GenerateChildren();
        }
        else
        {
            if(HasChild /* fast search if at least 1 child node exists */ )
             {
                return _dummyNodeList; // A list contains only 1 dummy node
             }
        }
    }
    return _children;
}


Ok, here is my question... I know VirtualTree needs only small amount of nodes when need, but my GenerateChildren() function is creating thousands nodes. Sad
Is any better way to setup my VirtualTree to generate nodes when necessary needed?

Thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Dec 07, 2010 2:19 am    Post subject: Reply with quote

The best way to handle this is to implement your own collection class that implements IList (or IBindingList) and creates the child items on-demand as they are accessed. See the following forum posts for more details:

http://www.infralution.com/phpBB2/viewtopic.php?t=1316

http://www.infralution.com/phpBB2/viewtopic.php?t=413
_________________
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