AD
Administrator
Syncfusion Team
July 14, 2003 11:37 AM UTC
Hi Olivier,
if access to your functions is O(1) I wouldn't worry. Only if you have code that takes more operations I would then choose a different solution.
PrepareViewStyleInfo is called each time a grid view needs information about a cell, e.g. when drawing or hit-testing. The information you provide with PrepareViewStyleInfo is not cached and thus gives you the best chance to return real-time results based on a grid views context and you can also take view-specific context such as current cell position into account.
The other event that lets you provide cell information is QueryCellInfo. This event is called from the GridModel itsself and provides cell-information independent of view context. This information is cached and only renewed when garbage collector collects the memory or when you call ResetVolatileData.
Another note: PrepareViewStyleInfo is called whenever you call GetViewStyleInfo. GetViewStyleInfo will always create a style object based on the grid models indexer and then call PrepareViewStyleInfo. After the style has been used style.Dispose will release the memory for this object immeditaly.
However, PrepareViewStyleInfo will not be called if you query for cell information by using the indexer. e.g. grid.Model[2, 2]. The indexer only calls QueryCellInfo if the cell information is not cached at the time of the call.
Hope this gives some insight.
Stefan