View previous topic :: View next topic |
Author |
Message |
gregoryagu
Joined: 12 Dec 2007 Posts: 78
|
Posted: Fri Feb 08, 2008 4:44 pm Post subject: Simple Tree Sample |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sat Feb 09, 2008 8:30 am Post subject: |
|
|
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 |
|
|
gregoryagu
Joined: 12 Dec 2007 Posts: 78
|
Posted: Wed Feb 13, 2008 8:42 pm Post subject: |
|
|
Thanks very much. I haven't had a chance to implement this yet, but I will here shortly.
Greg |
|
Back to top |
|
|
gregoryagu
Joined: 12 Dec 2007 Posts: 78
|
Posted: Thu Apr 17, 2008 3:06 pm Post subject: |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Apr 17, 2008 10:17 pm Post subject: |
|
|
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 |
|
|
|