I have found that I can set the ReadOnlyCellAppearance property to specify the backcolor. That seems to be applied of all cells that have Activation = NoEdit AND Activation.Disabled.
Question 1: Is it possible to use different back colors fpr every different Activation type?
Furthermore, however, I have different cells with Activation=NoEdit. Some of these cells should have an other back color than others.
Question 2: How apply different back colors to cells with Activation=NoEdit?
Thank you.
Markus
Hello Markus,
I am not entirely sure what you are asking but if it is when is this appearance being enabled, I believe when a cell has the Activation set to 'ActivateOnly' or if the cell is not allowed to be edited from the datasource.
Please feel free to let me know if I misunderstood you or if you have any other questions.
Hello Boris,
I have commented out some code and have found my error: for resetting cell color I checked if Activation=Disabled instead of Activation.NoEdit.
Finally can you answer my first question about dependecies of grid property ReadOnlyCellAppearance, BackColorDisabled and Activation ?
Thank you
Hello,
I do not see why this could not be working. I tried it in the InitializeRow event and it works fine. If you have set the activation property on the Columns individually you could use my code from the previous post. If you are setting it on the cell level you could use the switch statement as:
switch(cell.Activation){
....
}
Please do not hesitate to contact me if you need any additional assistance.
Hi Boris,
I'm not sure what you are showing me. In the InitializeRow-event I have code somethinh like this:
Depending on my data I set the Activation:
row.Cells[key].Activation = Activation.NoEdit;
row.Cells[key].Appearance.BackColor = myBackColor;
In the debugger I see that the color is applied, but the cell does not show the color. If you say that this must working, I must search other properties of the grid or something else in my code does not work because it is a complex grid.
In Activation.NoEdit the cells can be part of a selected block of cells. If the user makes some operation on the selected cells, I skip the cells in NoEdit-mode. Therefore I like to set the cell back color to grey like disabled in some areas of the grid but don't use Activation.Disabled because these cells can not be part of selected block of cells.
Best regards
I believe that you could do something like the following:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { foreach (UltraGridCell cell in e.Row.Cells) { switch (cell.Column.CellActivation) { case Activation.Disabled: cell.Appearance.BackColor = Color.Red; break; case Activation.NoEdit: cell.Appearance.BackColor = Color.Green; break; case Activation.AllowEdit: cell.Appearance.BackColor = Color.Blue; break; } } }