Hi,
Without getting into too much detail to start off, I have a Grid which binds to a BindingList of composite custom objects. The object, ill call them MyObject and MyAggroObject, both have the same properties exposed. The only difference being that MyAggroObject contains a BindingList of MyObjects where MyObject contains no sublist to bind to.
I use summaries on this grid so I have an UltraCalcManger and I subscribe to the ValueDirtied event. When I bind to a BindingList of MyObjects, after my grid loads, the ValueDirtied handler won't get called at all unless i click on a row/scroll/interfact with the grid in some way. When I Bind to my BindingList of MyAggoObjects, after the grid has loaded I get bombarded with RowCollectionReferenceResynched row within the inner band of the grid. Note that nothing is happening behind the scenes to change the objects that I am binding to.
Now this normally wouldn't bother me but I believe this event, and subsequent ReCalc calls to the CalcManager are causing my CPU cycles on my app to spike to 50%. This drops to 0, and the events stops being called, when I add a filter to the grid through the UI to filter out some rows. I only added the handler to the ValueDirtied event to see why the CalcManager was eating up so many cycles. I also didn't notice any spike when binding to a binding list of MyObjects.
So my question is, when should the RowCollectionReferenceResynched event be fired by the CalcManager? Also, I didn't see any references to performance issues with BindingList's on the forum, but has anyone else experienced this CPU spike when Binding with multiple bands?
This is a tough question. My guess is that the RowCollectionReferenceResynched fires once for each collection of child rows. So essentially once for each parent row when the child rows collection is created.
A CPU usage of 50% doesn't really seem all that significant to me. Is it slowing down your application?
Yea. It's a realtime application so the 50% hit causes slowdown across the board. We also have some users with older machines where the slowdown is very noticeable.
Is there anyway I can disable this event from firing/recalculating formulas? I have events in a class that manages the objects I am binding to that I can use to listen for collection changes.
Would suspending the calcmanager until the event has fired [numrows] times, then re-enabling calculations be a viable option?