Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4032
How update tree bound to composite pattern object
posted

I have bound my tree to BindingList<OrgUnit>. The only one OrgUnit-object in the binding list is the root of a composite pattern, it's represnting my client object of the organisation. The client object has some properties like 'Name' and also a property 'Childs'. The childs are the child organisation object. Child objects can also have childs etc.

All my business objects implemets the INotifyPropertyChanged interface.

If the tree comes up, all nodes looks fine. My problem now is how update the tree if my business object changes (new child, name of child changes, .....).

Changing the 'Name' property, only changes to the root node are reflected in the tree. I guess this is because the root is the only one object in my binding list.

Do I need some refactoring of my business objects in a way that the 'Childs' property also is a binding list?

Do you have a sample project of such a scenario?

Thank you. Markus

  • 18495
    Verified Answer
    posted

    Hello Markus,

    Your assumption is correct.  If all of the collection properties on your business object are instances of BindingList, then the UltraTree will update properly when the items in the collections are modified.