We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

conditional formatting of individual cells

I have a GridGroupingControl, where I want to set the background color of certain cells in ONE column, given certain criteria.

At a quick glance the conditional formatting using the GridConditionalFormatDescriptor would appear to do the job, but on closer inspection, it turns out I can only set properties of entire rows using this.

I would like to avoid using formatting events for this, if possible. What should I do? Should I design a custom celltype that takes some expression or something?

Or should I, every time the CueryCellStyleInfo event is triggered do my checks and fix this?

Thanks!

2 Replies

FL flix July 4, 2007 11:49 AM UTC

By the way, I also tried using the QueryCellFormattedText event, which doesn't trigger quite as often, using

e.style.Background = Color.blue;

with no visible result at all.

Isn't that odd?

>I have a GridGroupingControl, where I want to set the background color of certain cells in ONE column, given certain criteria.

At a quick glance the conditional formatting using the GridConditionalFormatDescriptor would appear to do the job, but on closer inspection, it turns out I can only set properties of entire rows using this.

I would like to avoid using formatting events for this, if possible. What should I do? Should I design a custom celltype that takes some expression or something?

Or should I, every time the CueryCellStyleInfo event is triggered do my checks and fix this?

Thanks!


HA haneefm Syncfusion Team July 5, 2007 09:21 PM UTC

Hi Felix,

You can not just ''set'' cell specific properties (other than the CellValue) in a GridGroupingControl. You can set column wide styles using grid.tableDescriptor.Column[x].Appearance property, you can set conditional row formats by adding ConditionalFormats. See this thread.

http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26929

that shows you "How to set cell-specific property in a grid?".

In version 5.1, we ship a sample that shows how style settings can be applied dynamically. If you want to provide formatting at run time, the QueryCellStyleInfo event handler is the right place to do that. It provides the GridStyleInfo object for a given cell on demand. This is the event that gets fired, every time a request is made, to access the style information for a cell. It is also used to conditionally change the style for a given cell. Inside this handler, you can apply style settings for a given celltype by using the GridTableCellStyleInfoEventArgs.TableCellIdentity.TableCellType property.Below is a link to this sample.

\Syncfusion\EssentialStudio\5.1.1.0\Windows\Grid.Grouping.Windows\Samples\2.0\Appearance\DynamicFormatting\cs

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon