Hi,
I am using conditional formatting on an ultragrid that also supports manual formatting (like excel)
my problem is when i set the backColor of a cell then try to apply a conditional formatting, the cell's backcolor is overriding the conditional formatting applied.(same problem for the forecolor)
i had the same problem for the Bold, italic and underline... i solve it by replacing the False by Default when removing bold or italic or underline... but with the backcolor and forecolor is there a way to let the conditional formatting override the cell's appearance?
thx
Conditional Formatting is considered a column-level appearance in the resolution process, so anything set directly on the cell is going to override anything set on the column, by design. The appearances will be merged, but if you set a BackColor on the column and also on the cell, the cell's BackColor will show. The only way to let the conditional formatting show is to either not set the appearance on the cell, or use the InitializeRow event instead to set the appearances of cells based on a condition. If you take the latter approach, you could resolve the appearances yourself to determine which should take precedence.
-Matt
Is it possible to change the value of a cell on the basis of some condition as we change the color of cell.
Actually my requirement is like I need to display blank if teh cell value is 0, for this I am using conditional formatting and on the basis of condition i want to set the value for a particular cell. I tried e.Cell.Content = ""; but it doesn't work.
Can you please let me know how i could achieve this?
You can't do this with an appearance, you would have to either modify the actual value of the cell, or else use a DrawFilter or a CreationFilter to change the display without affecting the value.
Another option would be to hide the actual column of values and then use an unbound column to display those values to the user. In the grid's InitializeRow event, you would examine the value in the "real" column and populate the unbound column with whatever text you want.
Well... the CreationFilter method is probably a much better way to go, since in this case, I think the unbound column would have to be a string, which would mess up filtering and sorting.
But if that doesn't matter to you, the code would look something like this:
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { int i = (int)e.Row.Cells["Int32 1"].Value; if (i == 0) e.Row.Cells["My Unbound Column"].Value = string.Empty; }
Mike Saltzman"] In the grid's InitializeRow event, you would examine the value in the "real" column and populate the unbound column with whatever text you want.
In the grid's InitializeRow event, you would examine the value in the "real" column and populate the unbound column with whatever text you want.
How do you do this?