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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

changing cell color at startup

Thread ID:

Created:

Updated:

Platform:

Replies:

17832 Aug 17,2004 11:47 PM UTC Aug 19,2004 12:47 PM UTC WinForms 2
loading
Tags: Grouping
Clario Menezes
Asked On August 17, 2004 11:47 PM UTC

Hi, I''d like to initialize the color of a set of cells based on their grouping grid coordinates, but I don''t want to affect the color of the group header rows/columns in the process. Here''s what I''d like to say in my TableControlPrepareViewStyleInfo handler: int row = e.Inner.RowIndex; int col = e.Inner.ColIndex; if ((col >= 4 && row <= 5) && "cell is not some sort of header") { e.Inner.Style.BackColor = Color.LightGoldenrodYellow; } Any ideas on how I can accomplish this would be greatly appreciated. Thank you, Clario

Administrator [Syncfusion]
Replied On August 18, 2004 10:46 AM UTC

Hi Clario, Try code like this instead: private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) { GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style; if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { Record r = style.TableCellIdentity.DisplayElement.ParentRecord; int recordIndex = r.ParentTable.Records.IndexOf(r); GridColumnDescriptor column = style.TableCellIdentity.Column; if (column.TableDescriptor.Columns.IndexOf(column) == 4) e.Inner.Style.BackColor = Color.Red; } } Not sure about this one but check out also the GridEngine.AllowCacheStyles property which we added for 2.1. Then you could do the coloring also in QueryCellStyleInfo. Then option forces GridRecordRow and GridCaptionRow elements to keep a cache with style information for individual cells and reduce the number of QueryCellStyleInfo calls being raised for this cells. Stefan

Clario Menezes
Replied On August 19, 2004 12:47 PM UTC

Thanks a lot, Stefan! The code you sent worked very well. - Clario

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.

Warning Icon 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.Close Icon

;