I have a winforms app that uses a grid and can bind to a typed dataset and shows the hierachy just fine,
When I make a similar sample and set the grid datasource to the main entity framework object I get a redundant recursive hierachy starting at the connection.
If I set the datasource to the top level entity table, I see the proper hierarchy in the "add new" button and see the rows for this top level parent table but there are no child rows if I click the + sign on the parent row.
Using datasource binding and the UltraDataSource shows the proper hierachy in the "add new" button diagram but show no data at all and I can debug the entity tables and the data is present.
Any suggestions?
Thanks, Dave
Apologies for resurrecting an old thread but I'm looking to solve a similar issue. I have a hiearchical model and various views. My object, lets call it A contains a BindingList<A> as a property called Children. I can add an item to the Children and View one will update correctly, but my second view doesn't. I think it's because the second view is not listening for the ListChangedEvents. The views are setup as follows:
View 1 (BindingList<A>) containing Children of BindingList<A>
View 2 (BindingList<B>) containing Children of BindingList<A>
The main difference is the root objects in the top level BindingLists are different types, the children are the same though. Anyone any ideas what I could do to remedy this?
Regards,
Martin
I submitted my example to Infragistics developer support. Hristo from that support team figured out the problem.
Again, my particular issue with bound hierarchical entity data was that the way I had things set up, new sub-rows added to the hierarchy after binding the list to the grid were not showing up. The .ResetBindings and .Refresh methods were not making the new sub-rows appear.
Hristo informed me that the mechanism UltraWinGrid uses to determine it must refresh the list, is to listen for the BindingList's "OnListChange" event. Since in my case, the new items were not being added to the BindingList itself, (they were being added to a collection of an object in the list) the BindingList doesn't know to raise the OnListChange event.
So, when binding the BindingList, UltraGrid is smart enough to traverse all sub-lists and create bands accordingly, but it had no way of knowing when a sub-list changed because BindingList doesn't raise an event to inform it. Hristo suggested two possible solutions:
1. modify my entity class so that the OnListChange event gets raised when sub-items are added to the child collection's of the objects in the list2. manually refresh the Band.Rows.Refresh method for the child band that just got a row added to it.
I went with 2. My code uses a button on a column of the parent-row that is set up as "ColumnStyle.Button". In the ClickCellButton event I can access the child band to refresh it as follows:
e.Cell.Row.ChildBands[
"Children"].Rows.Refresh(RefreshRow.ReloadData);
I was unaware of that little method in there. Thanks, Hristo.
Personally, it seems that the relationship between BindingList and UltraGrid could be improved so that changes to sub-lists that obviously had to be traversed to render them in the child bands can be tracked and auto-refreshed. But, being on the outside of those two black-boxes, I probably have no idea how difficult or possibly performance draining this might be.
Thanks Mike - I see it now... always one more tab on the UI somewhere. :-)
Hi,
I deleted your post for you. Please note that you can attach a file here on the forums under the Options tab.
Per Mike's suggestion to Dave, I created a support incident and attached a zipped up copy of my sample project to it.
Any assistance deleting my flawed post above would be appreciated.