Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Grid Column BackColor
posted

I am using an Ultrawingrid (Version 7.1).
(An isl style file is loaded when the app opens. I need to set the following programmatically and not in the isl)

The display has some GroupByRows and DataRows
In AfterInitializeLayout, I set the BackColor of certain rows based on a column value.
Additionally, I want to set the BackColor of specific columns. I am able to loop thru the cells in the row and set it.
1. Is there a direct way to set the column BackColor. I tried column.CellAppearance.BackColor, that does not work.

            //Set Row color

            foreach (UltraGridRow row in rowEnumerator) //DataRows)
            {
               row.CellAppearance.BackColor = ResetColor;

               if (row.Cells[ColumnA].Value.ToString() == "abc")
                {
                    row.CellAppearance.BackColor = NonEditColor;
                }

             //Set Column Color

             foreach (UltraGridCell cell in row.Cells)
             {
                 if (if(cell.Column.Key == "month")
                 {
                      cell.Appearance.BackColor = MonthColor;
                 }
      }
     }

2. I have a Save button on the form.
After making changes, once I click on save, a modal window is displayed indicating data being saved.
Once the grid gets back focus after the save (after modal window closes), the Row BackColor changes are retained. However, the BackColor changes on the Columns are lost.

I tried this

column.CellAppearance.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent;

That made no difference either.

Any ideas on why this might be happening?

Is there any other override required to keep the formatting done programmatically?

Thanks.