This sample illustrates code for a volatile data container that is optimized for non-virtual grids with few number of rows, where the QueryCellInfo event gets called only once for a cell and not multiple times.
Features
A derived GridControl class, a derived GridModel class, and a customized data store class are used to implement this one-time Query Cell Info grid.
Subscribe to the Query Cell Info event and use it to populate the grid with various cell values and styles. This code is hit only once for any given cell and is not needed thereafter.
The derived grid control class is named as OneTimeOnlyQueryCellInfoGrid. The derived grid enables to use a custom GridModel object and OneTimeOnlyQueryCellInfoGridModel.
The derived grid code hides the GridModel object and replaces it with a OneTimeOnlyQueryCellInfoGridModel object.
The OneTimeOnlyQueryCellInfoGridModel class is derived in order to use the GridModel.VolatileData object. It is this object that controls the style population.
Set UseGridOneTimeOnlyQueryCellInfoCache property of OneTimeOnlyQueryCellInfoGridModel to control the OneTimeQueryCellInfo functionality.
Through this property that the code sets up, either the standard GridVolatileData object is hit continuously or a special data store called the GridOneTimeOnlyQueryCellInfoCache is raised once per cell.
Include the GridNonVirtualDataCache.cs and PerformanceGrid.cs files in your project (or their VB counterparts) to use this functionality and declare a grid through code. Then, subscribe to its QueryCellInfo event to initially populate the grid and have this population code hit only once.
PrepareViewStyleInfo is still supported and can be enabled or disabled by using the GridControlBase.SupportsPrepareViewStyleInfo property.