I've just started working with the Syncfusion Grid and thought I would try the sample code at 3.4.1 (in the user guide) to set the style of a range of cells. The code looks pretty simple, but I cannot get it to work. Well, that's not the whole truth, it does work with a new born grid on the form, but I tried using the same code with a grid I have set up to be bound in virtual mode and it doesn't work in that case. I'm only new to the grid but it seems strange that the code to change cell appearance now does not work just because the grid is getting its data a different way?
More to the point, if I handle the QueryCellInfo event, the ChangeCells method doesn't work. Changing the TableStyle BackColor, however, does work. Looking at the GridStyleInfo order of precedence this doesn't seem to make sense. If the TableStyle BackColor is working (being displayed) then it seems logical that the BackColor property is not set anywhere higher in the hierarchy, so why doesn't changing the cells directly work? This should be higher up in the heirarchy right? i.e., CellStyle?
ADAdministrator Syncfusion Team December 17, 2002 03:41 PM
With pure virtual mode the grid itsself does not store the data. You need then provide both handler for QueryCellInfo and SaveCellInfo.
When you call ChangeCells, the grid will trigger SaveCellInfo events for every cell that needs to be changed. You have to provide a SaveCellInfo event handler where you save the style information (or the part of the style information you are interested in, e.g. the CellValue) in a data source that you provide.
If you just want to mix virtual supply of data with the grids internal datasource, make sure you do not set e.Handled = true for the QueryCellInfo event handler. That way you can just supply the part of the style information that is specific in your scenario and let the grid load the rest from its internal data store.
Check out also the VirtualGrid sample and VirtualGrid tutorial.
WHWayne HartellDecember 18, 2002 07:14 AM
Thanks Stefan. I had not yet read the documentation on the virtual grid (I had just looked at a code sample). Yeah, the mixed mode is exactly what I want. I want to supply the data to the grid, but I'm happy to let it take care of its own styles since in my intended application I think I can get away with using only base and/or column and row styles which I'd imagine are pretty efficient anyway.