I have a large dataset which is rapidly updating.
Each update triggers the QueryCellInfo in order to populate the cell.
I wish to size the column to the size of the data.
Calling ResizeColumnsToFit() after each update seems to performs very slowly. I believe this is because this method is addressing the whole table, rather than just the cell (and thus column) which has updated.
So I tried manually sizing the column within the QueryCellInfo. But this causes an exception
eg
private void OnGridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
...
var size = e.Style.CellModel.CalculatePreferredCellSize(e.Cell.RowIndex, e.Cell.ColumnIndex, e.Style, GridQueryBounds.Width);
if (size.Width > grid.ColumnWidths[e.Cell.ColumnIndex])
{
grid.ColumnWidths[e.Cell.ColumnIndex] = size.Width;
}
}
Is there an event subsequent to the QueryCellInfo I can attach to which wouldn't cause this exception?
Or an alternate solution?