The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I'm using the GridControl class as a base for a virtual grid which displays a relatively small number of columns (and a potientially large number of rows).
I currently customise the properties in the GridStyleInfo depending which type of data the column has to display (maximum numeric values, maximum caracters, readonly and such) in the OnPrepareViewStyleInfo method (which I think is called before the QueryCellInfo of each cell)
All of my custom properties are stores in "simple" (O(1)) variables .
Would there be a noticable performance increace if i where to store these values in the column style instead ?
(its working fine as it is so i wouldn't want to change the design unless there were a performance increace or someone pointed out that i was shooting myself in the foot ;)
Olivier
ADAdministrator 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