Hi
I would like to alternate my rows in my ultragrid every 3 rows, the alternate object like :
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.RowAlternateAppearance.BackColor = Color.Cyan; }
works well but I want to have a color only every 3 rows.
Thanks
Hello,
I got your requirements wrong I now can see that. Please use the following code sample:
int counter = -1; Color clr = Color.White; private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if (counter < 2) { counter++; } else { counter = 0; if (clr == Color.White) { clr = Color.Red; } else clr = Color.White; } e.Row.Appearance.BackColor = clr; }
Hi it is almost that,
But what I want is : 3 rows white, 3 rows blue, 3 rose white etc...
you code sample gives : 3 rows white, 1 rows blue, 3 rose white etc...
You could achieve this with the following code sample:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if (e.Row.Index % 3 == 0) e.Row.Appearance.BackColor = Color.Cyan; }
Please feel free to let me know if I misunderstood you or if you have any other questions.