Hello,
I noticed something peculiar using an Ultragrid, UltraDatasource, LoadStyle.LoadOnDemand, BeginUpdate() and EndUpdate(). Under Windows 7 x86, 64, Windows 8 and Windows XP (configured with a Windows XP theme) all works smoothly.
However, under Windows 2008 (non aero theme) or Windows XP with a Classic Theme, the background flashes to black for a second using BeginUpdate() and EndUpdate(). When I leave using the two methods out of my code, the background doesn't flash and forth to black and then white. I've tested with Infragistics 2011.2 and 2012.1, both have the same behavior.
What could be the issue here?
regards,
Roel van Bueren
Hi Roel,
When you call BeginUpdate on the grid, this tells the grid not to paint itself. If something invalidates the grid and forces the grid to repaint - like if you called the Refresh method, for example, then the grid would be painted and simply skip it's own internal painting logic and it would end up painting in solid block.
So my guess is that something in Windows XP is forcibly invalidating and re-painting the grid while you are inside your BeginUpdate/EndUpdate block. There are some known differences in the way Windows XP handles painting under certain conditions. For example, when you resize a form, some O/S's will force the controls on that form to paint and others will not.
Tracking this down will be probably be pretty difficult. It depends what exactly is happening in between the BeginUpdate and EndUpdate statements.
If you want to try to track it down, then there are a couple of approaches you could try.
1) Immediately before, or perhaps after, you call BeginUpdate, hook the Paint event of the grid and put a breakpoint in the event. See if it gets hit and if it does, you can look at the call stack and that might give you a clue as to what's forcing the grid to paint.
2) Take a look at the code you are using in between BeginUpdate and EndUpdate and try commenting out parts of it to see if you can narrow down the code that is causing the flicker. The flickering may not be caused directly by this code, of course. This code could be triggering an event and that event handler code could be the cause. So you may also want to try commenting out any event handler code for your grid (and possibly other controls on the form) to see if you can narrow it down that way.
One additional question here. In the same situation I'm using the InitializeRow event of the grid in order to set the row appearance, which basically only contains an image here. Since the image is a file icon, which has to be extracted from the file first, this process is relatively slow and therefore slows down the total performance of loading the grid with new data.
What's the best way, using LoadStyle.LoadOnDemand. Do I have to run this in a separate thread e.g.?
Hello Roel,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.