Hello,
I have a a windows form app where I am using a UltraGrid control. This grid control has it's datasource set to a BindingList<MyCustomObject>. The datasource is initialized to a null BindingList and I add and remove items from the list at runtime.Because MyCustomObject has some nested properties I need to access and I want to flatten them in the grid I have some unbound columns that I set up in the InitializeGrid event and then populate in the InitializeRow event. My app will dump 2k items into the binding list at once and the insert in the the list is fast. For each row added the InitializeRow event is called on the grid properly but, it is slow. My population of the bindingList takes a second or 2 and then the InitializeRow events continue to fire for another 10-15 seconds.
I would like to display a "please wait" dialog during the time that the grid is initializing all the rows. Is there some event I can tie into to do this and build a please wait that wraps all initialize rows?
Hi Jay,
There's no event for this. Binding is an ongoing process - it never ends so there's no event that can tell you when the binding is finished.
You could try showing your "please wait" message and then clearing the message in the grid's Paint event. That might work, but quite frankly, I wouldn't risk it. Even if it seems to work, it might give you problems later on - it will be unpredictable.
2,000 rows really isn't a lot. If it were me, I'd see if there's anything I could do to make the InitializeRow code more efficient (and thus faster).
Have you tried taking a look at the WinGrid Performance Guide? There are some tips there on how to use InitializeRow most efficiently.
Mike, Thanks, I figured as much. I was performing some LazyLoading in my objects and I'll just do that before the bind to the grid. THis way I cna display my please wait and then the bind will perform much better. Not ideal but it will work.
Thanks.