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 

Simple Tree Sample

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



Joined: 12 Dec 2007
Posts: 78

PostPosted: Fri Feb 08, 2008 4:44 pm    Post subject: Simple Tree Sample Reply with quote

If I start with the Simple Tree sample, and add an Add button and add a part at run time, it immediately shows up in the tree.

However, if I add a change button, and change the name of a part, say the "Car" part, it does not automatically show up in the tree.

If I call _VirtualTree.Update(), the change then does show up.

But I thought the whole point was that with a binding list, the changes would show up automatically.

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Feb 09, 2008 8:30 am    Post subject: Reply with quote

Quote:
But I thought the whole point was that with a binding list, the changes would show up automatically.


Yes that is the point - but the Simple Tree sample is a "simple" sample and the Part class does not implement the INotifyPropertyChanged interface. If you implemented this interface and raised the PropertyChanged event in the set access of the Name property then the tree would update automatically. This assumes that you have changed the ChildList from an array list to a BindingList<Part> - which you must have done or the tree would not be updating automatically when you add a part (you would have to call VirtualTree.UpdateRows after adding the part).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
gregoryagu



Joined: 12 Dec 2007
Posts: 78

PostPosted: Wed Feb 13, 2008 8:42 pm    Post subject: Reply with quote

Thanks very much. I haven't had a chance to implement this yet, but I will here shortly.

Greg
Back to top
View user's profile Send private message
gregoryagu



Joined: 12 Dec 2007
Posts: 78

PostPosted: Thu Apr 17, 2008 3:06 pm    Post subject: Reply with quote

I have now implemented this, and it works great for the most part.

What doesn't work is when an item is a child of another item. Since Child Items are not a part of the BindingList, then even though BindingListChanged is called, the child items do not update.

Currently, the Children are gotten through calls to GetChildren(). I suppose to make it work fully, the children would get added to the list as actual children to the object, not just fed in as children via a method call.

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Apr 17, 2008 10:17 pm    Post subject: Reply with quote

As long as the Children list returned in GetChildren is also a BindingList (and the child objects also support INotifyPropertyChanged) then this should work for any level of the tree.
_________________
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