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
340
Problem with resetting Back color of a cell after exiting edit mode
posted

Hi,

I try to reset the BackColor of a cell back to Color.White when it exit edit mode. FOr example, when the cell is activated I set a new color and when it is deactivated I want to set it to white, but it is not working. I have done all these things in the even, but it does not change the back color of the cell, except it works for the first cell of the row. I am using version 11.2.

 

UltraGridCell prevCell = null;   //the previous cell

void BAGridDataEntry_AfterEnterEditMode(object sender, EventArgs e)  

{      

 if (this.ActiveCell.Column.CellMultiLine == DefaultableBoolean.True)          

this.ActiveCell.ActiveAppearance.BackColor = System.Drawing.Color.LightYellow;      

 else          

this.ActiveCell.ActiveAppearance.BackColor = System.Drawing.Color.Ivory;      

 prevCell = this.ActiveCell;  

}    

 void BAGridDataEntry_AfterExitEditMode(object sender, EventArgs e)  

 {      

 if (prevCell != null)      

{          

 this.ActiveCell.Appearance.ResetBackColor();          

this.ActiveCell.Appearance.BackColorDisabled = System.Drawing.Color.White;          

 prevCell.Appearance.ResetBackColor();          

prevCell.Appearance.BackColorDisabled = System.Drawing.Color.White;

          prevCell.Appearance.BackColor = System.Drawing.Color.White;          

 prevCell.ActiveAppearance.BackColor = System.Drawing.Color.White;          

prevCell.Appearance.BackColor2 = System.Drawing.Color.White;          

prevCell.ActiveAppearance.BackColor2 = System.Drawing.Color.White;      

}         

 }