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.
Unfortunately, activation email could not send to your email. Please try again.

Colouring Rows

Thread ID:

Created:

Updated:

Platform:

Replies:

21461 Nov 10,2004 06:01 PM Nov 12,2004 04:26 AM Windows Forms 3
loading
Tags: Grouping
David Llewellyn
Asked On November 10, 2004 06:01 PM

Hello, I am currently using PrepareViewStyleInfo to change the colour of a Row in a grouped table (GridGroupingControl), when a Row/Column is set to say ''True''. This value cannot be changed, so the colour doesnt need to be changed, once it has loaded. But changing the colour in PrepareViewStyleInfo slows the table down. Is there another way to set the colours? Thanks, David.

Administrator [Syncfusion]
Replied On November 11, 2004 04:25 AM

Another way you can do this is to use conditional formats. GridConditionalFormatDescriptor cfd = new GridConditionalFormatDescriptor("Big"); cfd.Expression = "[Col2] > 4"; cfd.Appearance.AnyCell.BackColor = Color.LightBlue; this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(cfd); Here is a forum thread with another sample. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11621

David Llewellyn
Replied On November 12, 2004 02:35 AM

Hello Clay, Thank you for the information. Is there anyway to write an expression that will filter out records which are equal to say, "Bob". I would then like to colour the row. Something like -> cfd.Expression = "[ColumnName] = Bob"; cfd.Appearance.AnyCell.BackColor = Color.LightBlue; this.gridcontrol.TableDescriptor.ConditionalFormats.Add(cfd); I have tried this to no avail. Should I be enclosing the "Bob" string in quotes or something? Or am I unable to use the expression like this? I have also got another question that is related to my previous one. I am setting the cells tooltip, in PrepareViewStyleInfo, to the same value that is displayed in that cell. Something like this :- private void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { GridRecordRow rec = this.gridcontrol.Table.DisplayElements[e.RowIndex] as GridRecordRow; if(rec != null) { DataRowView colorrow = rec.GetData() as DataRowView; try { if ((e.ColIndex > 3) && (e.ColIndex < 7)) e.Style.CellTipText = colorrow[e.ColIndex-3].ToString(); } catch { } } } This method REALLY slows down the grouping grid. Do you know of a better way of setting the tooltips of the cells? Thanks again. David.

Administrator [Syncfusion]
Replied On November 12, 2004 04:26 AM

You would use the Like operator. cfd.Expression = "[ColumnName] LIKE ''Bob''"; You use single quotes to delimit a string for the LIKE operator. (The web interface may double the single quote in teh above line.) You could also use the MATCH operator.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;