When I load my tree with a one-level list (that is, I'm binding it to a list object that contains only objects that are not themselves lists), in my InitializeDataNode handler, node.Cells.Count == 0. If I load my tree with a multi-level list (the top-level list contains other lists, which then contain other objects), this is not the case.
I'm trying to set an image into one of the columns during InitializeDataNode, and I can't do it because the cell apparently hasn't been created yet. What can I do about this?
Thanks, Aaron
Hi Aaron,
I have tested to bind the tree to a list of objects and the InitializeDataNode event fires every time a node is added. I would need more details about your scenario and how you bind your data to the tree to say what the issue might be.
I am looking forward to hearing from you.
Regards,
Stefaniya
I'm binding the tree to a custom object derived from BindingList<object>. In the problematic case, this object's children are my display objects and there are no other lists. One other data point - this happens only the first time I bind the tree. If I bind it to a multi-level object tree, and then rebind it to a single-level object list, there's no problem.
I think I have an idea as to what's going on here, and a possible workaround, but I'd like your opinion on whether this is going to cause me problems. I have a handler for AfterDataNodesCollectionPopulated that's assigning column sets to the tree levels using NodeLevelOverrides. The first time the tree is bound and the InitializeDataNode event is fired, this hasn't happened yet, so I have no column sets assigned. This is presumably why he's not creating cells for the node.
My workaround is to assign the column set that I use for my display objects in the tree's Override.ColumnSet property. This does appear to solve the problem, but I'm concerned that it's going to cause an issue somewhere because my list objects don't have all the properties that that ColumnSet is looking for. What do you think?