I have a grid that is bound to a collection of objects. There are cases where I need to change the foreground color of a specific cell in a row to red. I have this working except for when the row is selected. When a row is selected the text color for all of the cells in the entire row changes to white. When that happens the user cannot tell that the cell in question is red until he selects a different row. How can I keep the formatting of my cell even when the row is selected?
Thanks,
Matt
Mike,
I got the DrawFilter working the way I need it to using the example you pointed me to. Thanks for you help.
I do allow row selection but not cell selection so that's what I meant. I didn't think the cells were actually selected even though a row is. Sorry for the confusion. Here is the code that I've tried in the grid's AfterSelectChange event and the selected row still has a fore color of white instead of dark red.
For Each row As Infragistics.Win.UltraWinGrid.UltraGridRow In grdActivities.Selected.Rows row.Cells("StartDateTime").SelectedAppearance.ForeColor = Color.DarkRed row.Cells("StartDateTime").SelectedAppearance.FontData.Bold = DefaultableBoolean.True row.Cells("StartDateTime").SelectedAppearance.FontData.SizeInPoints = 12.5 Next
The DrawFilter may work for me. But I need to know how to have it only apply to certain cells in a row and not every cell.
Hi Matt,
What do you mean "cells are not actually active or selected in my grid?" The SelectedAppearance on the cell will apply, even if the cell itself is not selected, but the cell appears selected because the row or column are selected. So that should work okay. Unless you are not allowing selection at all and just simulating it in some way - in which case, you would not be having the problem of the forecolor changing when the row is selected. So that doesn't make sense to me.
The alternative solution, before we added SelectedAppearance on the cell and the SelectionOverlay stuff would be to use a DrawFilter. It's much more complex and difficult, but there's a discussion about this approach along with some sample code here:
DrawFilter for Backcolor - Infragistics Forums
Hristo,
Your code example gets me about 99% of the way there. However you are setting the back color of every cell in a particular row to red. I only want to set the color of certain cells in a row to red. How can I indicate which cells should have the special format in a row?
Thank you both for your responses. I am using version 8.1 of Infragistics and I read that the SelectionOverlay feature wasn't introduced until version 9.2. Upgrading is not an option for this project. I've tried setting ActiveAppearance and SelectedAppearance of the cell but cells are not actually active or selected in my grid. I have tried manually marking the cell as selected in the AfterSelectChange event and setting the .SelectedAppearance to a predefined appearance that I have created. However when the row is selected the cell still looks the same and the text is still white.