I'm not sure if this is a problem or if there something different I need to do to show recursive relationships properly. What I've noticed is that TreeListBox seems to get all confused with how to display a node when it's underlying item part of a recursive relationship. Here's a very simple example: say I have a database schema that I'm representing in the TreeListBox. The top node is the database name, children are the tables and each table's children are the columns. This works perfectly. So let's say there's an Orders table and an OrderLineItem table. One of the columns in the OrderLineItem table, OrderId, is a foreign key to the Orders table. I want to display the Orders table and its columns as a child of the OrderId node in the TreeListBox so I add the Orders object I already have as a child of the OrderId treenodemodel item. This is where things start to go sideways. When I expand the OrderId node, the Orders object displays. When I expand the nested Orders node, the identation is incorrect and the Orders node under the Database node also expands. It's like TreeListBox has bound the same instance of it's treelistboxitem to both places because the underlying object in the Items collection is the same.
I tried a few ways to resolve this: I set virtualization to standard on the TreeListBox control but that had no effect. I created a shallow copy of the underlying Order object and added that to the OrderId column's treenode children collection, but that just caused runtime data binding errors. Finally, I created a partial copy of the Orders object and added that to the OrderId treenode's children collection. It works correctly but it's a sub-optimal solution because now I'm creating thousands of object clones (in my real-world application) and using up system resources that I really shouldn't need to. Any suggestions? I have a small project that illustrates this. Just let me know how to get it to you.
[Modified 2 months ago]