Question about Alternate Row colors
Hi,
I know that you can make all the even rows be a different color by code like:
gridReport.TableDescriptor.Appearance.AlternateRecordFieldCell.BackColor
But how do you make the odd rows be a different color?
I know that you can make all the even rows be a different color by code like:
gridReport.TableDescriptor.Appearance.AlternateRecordFieldCell.BackColor
But how do you make the odd rows be a different color?
SIGN IN To post a reply.
7 Replies
JJ
Jisha Joy
Syncfusion Team
August 30, 2010 07:30 AM UTC
Hi David,
You could achieve the desired behavior by handling TableControlPrepareViewStyleInfo event.
void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
e.Inner.Style.BackColor = Color.Lavender;
}
}
Regards,
Jisha
You could achieve the desired behavior by handling TableControlPrepareViewStyleInfo event.
void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
e.Inner.Style.BackColor = Color.Lavender;
}
}
Regards,
Jisha
DM
David Mecteaux
August 30, 2010 08:43 PM UTC
Thanks for the response. Could you also give me some code to change the Color of the odd and even rows when dealing with a Detail table (instead of just the Master table)?
Thanks.
Thanks.
JJ
Jisha Joy
Syncfusion Team
September 2, 2010 07:07 AM UTC
Hi David,
Please see the code to change the Color of the odd and even rows in both master and detail table.
void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
e.Inner.Style.BackColor = Color.Lavender;
}
if (style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell )
{
e.Inner.Style.BackColor = Color.PaleGoldenrod;
}
}
Sample attached.
Regards,
Jisha
CS_13297ed5.zip
Please see the code to change the Color of the odd and even rows in both master and detail table.
void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
e.Inner.Style.BackColor = Color.Lavender;
}
if (style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell )
{
e.Inner.Style.BackColor = Color.PaleGoldenrod;
}
}
Sample attached.
Regards,
Jisha
CS_13297ed5.zip
DM
David Mecteaux
September 2, 2010 01:51 PM UTC
Hi,
I do realize how to change the odd and even row colors globally for each Table. But I was hoping to have a different odd/even color for each Table and not the same color scheme.
So my master table might be pink and tan.
My Detail_1 table might be yellow and orange.
My Detail_2 table could be light red and purple.
I do realize how to change the odd and even row colors globally for each Table. But I was hoping to have a different odd/even color for each Table and not the same color scheme.
So my master table might be pink and tan.
My Detail_1 table might be yellow and orange.
My Detail_2 table could be light red and purple.
JJ
Jisha Joy
Syncfusion Team
September 3, 2010 10:23 AM UTC
Hi David,
Please refer the following browser sample that shows how you can customize the appearance of nested tables in GridGroupingControl.
..\\Windows\Grid.Grouping.Windows\Samples\2.0\Appearance\Table Style Demo\cs
Regards,
Jisha
Please refer the following browser sample that shows how you can customize the appearance of nested tables in GridGroupingControl.
..\\Windows\Grid.Grouping.Windows\Samples\2.0\Appearance\Table Style Demo\cs
Regards,
Jisha
DM
David Mecteaux
September 3, 2010 02:23 PM UTC
Thanks Jisha!
That was exactly what I was looking for.
That was exactly what I was looking for.
JJ
Jisha Joy
Syncfusion Team
September 6, 2010 05:21 AM UTC
Hi David,
Thank you for your update.
Regards,
Jisha
Thank you for your update.
Regards,
Jisha
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
DM David Mecteaux
- Aug 27, 2010 02:16 PM UTC
- Sep 6, 2010 05:21 AM UTC