Hi there,
I would like to change the row background of the first 5 rows after the data on the grid has been sorted but I am having a couple of issues.
I hook into the Sorted event and get the rows from the grid and I loop through the first five and set the background. This almost works but it only changes the backgrounds of every second row. I think that the AlternateRowBackground set on the grid is overwriting the value I set.
Another issue I am facing is that there are two ways in which I sort the grid. The above approach only works when the user sorts by clicking on a column. However the Sorted event doesn't seem to fire when I add a SortDescriptor in the code-behind and I'm not sure why.
Is there something obvious that I am missing? Or is there a better approach to achieve what I am looking for?
Thanks,
Steven
I would like to change the row background of the first 5 rows after the data on the grid has been sorted but I am having a couple of issues.
I hook into the Sorted event and get the rows from the grid and I loop through the first five and set the background. This almost works but it only changes the backgrounds of every second row. I think that the AlternateRowBackground set on the grid is overwriting the value I set.
Another issue I am facing is that there are two ways in which I sort the grid. The above approach only works when the user sorts by clicking on a column. However the Sorted event doesn't seem to fire when I add a SortDescriptor in the code-behind and I'm not sure why.
Is there something obvious that I am missing? Or is there a better approach to achieve what I am looking for?
Thanks,
Steven