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;
Fixed it!
We have inhereted WinGrid and we want to do that in that grid and the data is changed somewhere in the client, so the WinGrid has no idea of the column name. The WinGrid can only know if that column/cell is muti line and respond to events. I want to be able by changing the attributes of ActiveRow and ActiveCell, which I can do when the cell enteres the edit mode, and also when I move to another row the previous row back color is cleared, but I want the cell back color to be cleared when the next control in the same row in activasted.
Hello Alex,
If you want to change the appearance of a particular cell then why do not you use something like the following:
ultraGrid1.Rows[0].Cells["Key"].Appearance.BackColor...ultraGrid1.Rows[0].Cells["Key"].ActiveAppearance.BackColor...
Or maybe I am missing something? You could also set these appearances for a whole column.
Please feel free to let me know if I misunderstood you or if you have any other questions.