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.
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
ADAdministrator Syncfusion Team 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
CMClario MenezesAugust 19, 2004 12:47 PM UTC
Thanks a lot, Stefan! The code you sent worked very well.
- Clario