I am using a nested set model to display a hierarchy of items.
I am using two typs of objects to display this, the first is the 'Item' object, this has the following:
IDataErrorInfo ICloneable IEditableObject
The second is a collection object, this is publically exposed through the above 'item' object in the Children property.the collection object has the following properties:
ICloneable CollectionBase IBindingList
Through this setup i can create a parent/child relationship of X levels, after i have, i simply set the DataGrid's datasource to the collection object holding a single 'item' object (This then has the 'children' objects which expand into bands showing the hierarchy.)
This is working fine, but unfortunately there have been many instances (Seemingly random) where certain setups of Child/Parent seems to break the grid layout.
The normal behaviour of the grid if a property exposes a collection type is to display all the items INSIDE that collection. When the grid 'breaks' it fails to show the children of that collection property (i.e. Children) instead showing the layout of a collection type ... i.e. it shows Capacity & Count columns.
As i say, this seems to happen completely randomly, certain setups of parent and child will go 4 levels deep, where if i add a second item into the 'root' node, the whole grid collapses after the second level node. This happens when i initially set the datasource.
The problem also shows itself (everytime) when you have set the datasource (which displays correctly) and add an item to another item's Children property in code. If the item has no children in its collection, the grid will break, if however the item has existing children in it's collection when the datasource was originally set, the new child of that item will display correctly.
I'm expecting you to tell me to use the UltraTree, but that it not displaying the items correctly either, thats a seperate issue which i will tackle if i'm forced to use the tree. I would however much rather use the UltraGrid.
Any solutions or is this a bug?
It's hard to guess without knowing exactly what the situations are which are not working. My best guess is that your data source is not homogenous. If the number of levels varies from object to object, then the DotNet BindingManager will get the structure of the data from the first row in the hierarchy. If the first row at any level returns null or returns an empty list that does not implement IEditableObject or ITypedList, then the BindnigManager cannot go any further in determining the data structure and that level of the data will not display correctly in the grid.
The UltraWinTree can handle situations like this where the data structure is non-homogenous. But you may have to handle the creation of ColumnSets, depending on just hoe complex the data structure is.