Advanced Virtual Grid Topics
Only the Value property from the style is stored, and the grid does not store any non-default styles. The grid manages its own size.
As mentioned in “Using Virtual Grids”, Objective Grid for .NET allows for some flexibility in the implementation of virtual grids. The following changes could be made to the sample to allow for greater control over the virtual grid:
*More than just the cell value could be stored in the hash table. If desired, the entire style could be stored. User-specific data could also be stored for each cell.
*For greater control over the virtual grid, a derived grid class could be created. This would allow the user to control the size of the grid by overriding GetRowCount and GetColCount to return specific values.
NOTE >> When overriding GetRowCount and GetColCount, you should be aware of the following: GetRowCount() and GetColCount() are used extensively to validate grid values. In addition, these methods may be called on every mouse move event. It is not unusual for GetRowCount() to be called thousands of times in a short period of time. Because GetRowCount() and GetColCount() are called quite often, your overrides of these methods are not an appropriate place to do extensive calculations.
*The StoreStyleRowColEventArgs object supplied to StoreStyleRowCol event handlers has two properties that can be used to further customize the behavior of virtual grids.
*The Stored property—This property can be set to true to indicate that all style information that needs to be stored has been stored by your event handler. When set, it prevents GridControl event handling, which stores the style to the grid. If the SetStyleRange is invoked with style information other than cell value information, that style information would not be stored in either the grid or the data structure. If a hybrid approach is desired, where the grid would store some font or color information, for example, then the Stored property should not be set to true.
*The CanStore property—This property indicates whether or not the style information for the cell could be stored. For example, you may choose to perform some data validation at this time. If the data is not valid and cannot be stored, this value should be set to false. If false, the current cell cannot be changed, and the user must supply a valid value for the cell.