Hello,
I am using Infragistics 14.1 and have a feature where I highlight certain cells in a grid by changing the fore and back colors. Using the following code:
foreach ( UltraGridRow xRow in ugGrid.Rows ){ foreach ( UltraGridCell xCell in xRow.Cells ) { if ( Conditons are met ) { xCell.Appearance.ForeColor = Color.White; xCell.Appearance.BackColor = Color.Black; } }}
I have a clear button which I would like to have set the grid back to the original appearance however I have been unable to find anything that will override the cell appearances.
I've tried looping thru each row and setting the RowAppearance as well as using the ResetForeColor and ResetBackColor methods.
I know I could loop thru each cell and change the appearance of each cell but wanted to see if there was a better/easier way of doing it.
Thanks in advance!
If you are coloring the cells based on some criteria based on the value in the cells or some other cells in the row, then a better approach would be to simply use the InitializeRow event instead of looping.
Then you can reset the appearance on the cell whenever the conditions are not met, or clear the colors by setting a flag and then calling grid.Rows.Refresh(InitializeRow) to make InitializeRow fire again.