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
210
UltraTree binding update ?
posted

I have an UltraTree

 

I also have a BindingSource that has a List<ClassA> as it's Data source. Plan jane stuff

 

I call set DataBinding

 

tree.SetDataBinding(bsBindingSource, null);

The list has classes with collections but their all empty.

So the tree populates fine( 1 level )

 

On the AfterActivate event I then add an item to on of the lists' class collections ( ClassA.MyCollection.Add())

 

I can bsBindingSource.ResetBindings()

 

But the Tree View Doesnt show a 2nd level tree item.

 

I can add one manually, but how do I get the tree view to see the second level?

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    The tree gets the data structure from the BindingManager in DotNet. My guess is that if you are using a List<T>, then the BindingManager cannot get the structure from the child band without having an actual row to work with.

    Normally, what it will try to do in a case like this is add a row and then cancel that row using the IEditableObject interface. But I don't think List can support that, you would have to use BindingList and implement IEditableObject on your list items. Implementing ICancelAddNew on the BindingList instead of using IEditableObject on the items might also work, but I haven't actually tried that.

Children