I'd like to have it stop redrawing, then update all the bound data, then redraw the whole thing. Any way to do this?
You should use the BeginUpdate and EndUpdate methods of the grid.
-Matt
It doesn't appear to work. When I use BeginUpdate, then change about 30 rows in DataSet, then call EndUpdate, the behavior I see is that it updates row by row, redrawing each time, and costing me huge performance-wise. I would expect all the rows to simultaneously change?
It's hard to say what's going on without more information. When are you performing this logic? Are you doing anything in the InitializeRow event? Do you have a CalcManager associated with the grid?
This logic is performed ad-hoc, whenever new data comes in. I BeginUpdate, then do all the dataset updates, then EndUpdate. Nothing in InitializeRow and no CalcManager. It seems like modifying the dataset, the grid shows the changes one row by one row and updates the whole grid one row at a time? Seems like maybe it's iterating and any row update it redraws the whole thing?
You might also want to try this:
grid.BeginUpdate();
grid.SuspendRowSynchronization();
try
{
// Add or edit rows here
}
finally
grid.ResumeRowSynchronization();
grid.EndUpdate();
If that doesn't work, then something in your code must be forcing a paint in spite of the BeginUpdate call.
Hmm, it seems to work in that new grid. May be something my end, there are a lot of events around this grid, I appreciate the help very much.
While I know that many optimizations were made for the 7.3 release, particularly with making the drawing/invalidation logic more efficient, it still doesn't seem like this should be happening. The purpose of BeginUpdate is exactly to suspend any painting logic until you call EndUpdate. Are you saying that you see the rows being updated *between* your calls to these two methods? Do you see this in a simple sample (i.e. just generate a DataTable with some number of rows and loop through them to update)?