We have a wingrid with group by feature enabled, want to apply color at row level based on the value in 2-3 columns. e.g. we have username,type,start date,end date,task columns - IF task type is 1 and start date doesnt have value then row will appear in color1 and if start date have some value then row must appear in color2. and futher like that...
I am able to achieve only coloring at column level correspdoning to value in column by using conditional formatting, but not able to color rows based on values present in other columns.
Please suggest a way of doing this...
Grid.Rows is always the first band rows. If you use groups, only the groupby rows are in the first band. You can loop through all rows by using grid.Rows.GetRowsEnumerator and check for each row IsDataRow.
The InitializeRow event occurs also when the user changes a cell value. Why do you need to assign the data source again? Anyway, you can force the event by using
ultraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.FireInitializeRow, true)
Hi Amiram, Thanks for the reply!
My issue over here is when I try to get the rows from grid in a case when user has applied 3-4 group by filter then the
ugvWeekendDevice.DisplayLayout.Rows
is retruning the NULL... so how to get the rows when groups are applied... In addition to it, user have facility to change the start/end date on grid in that case color must change dynamically, but if I am writing the code in InitializeRow event then next time when i will assign the datasource aftera change color wont be changing.
Use the InitializeRow event. You can check any cell value by e.Row.GetCellValue(column) and set the color of a row by using e.Row.Appearance.BackColor. This event is fired when the row is initialized and after any cell value is changed (but then e.Reinitialize is true).
If you're checking more than one cell value, I think you'de better use e.Row.ListObject, cast it to your type, and check its properties.