Infragistics4.Win.UltraWinGrid.v17.2, Version=17.2.20172.2006
I need to re-format visible rows after 1.sort order is changed and 2.filter is applied.
I tried the 'AfterSortChange' event but seems it's fired before rows are actually sorted.
Any ideas, please?
Hello Alexander,
I have been investigating into the behavior you are looking for, and I have some information for you.
Regarding an event for after the sort order changes, I would recommend utilizing the AfterSortChange event. After this event fires, you should see that the Rows collection of the UltraGrid is sorted.
Regarding an event for the filter changing, I would recommend using the AfterRowFilterChanged event. This event’s argument has a Rows collection that returns the rows that the filter will be applied to. You can also use the UltraGrid.Rows.GetFilteredInNonGroupByRows() method to get the filtered in rows.
Please let me know if you have any other questions or concerns on this matter.
Andrew Goldenbaum said:I would recommend utilizing the AfterSortChange event. After this event fires, you should see that the Rows collection of the UltraGrid is sorted.
As I originally stated in my question this does not work. The dataGrid.ActiveRowScrollRegion.VisibleRows does not contain rows that should be visible after the sorting is applied. Instead it contains (most likely) rows that were visible before the sorting is applied.
My apologies, I must have misread that you were looking for the visible rows after sorting rather than just an event that fires after sorting.
It appears that you are correct that the UltraGrid.ActiveRowScrollRegion.VisibleRows is not updated with the sorted list of rows as this event fires. I have been searching for an event that fires after this has updated, but I am unfortunately yet to find one. What I find rather strange however, is that the FirstRow property of the UltraGrid.ActiveRowScrollRegion does appear to be updated at the point that AfterSortChange fires.
Knowing this, perhaps something you could do as a workaround is utilize that FirstRow property with the Rows collection of the grid and get the index of that FirstRow and then loop from that point. You could also use the UltraGrid.ActiveRowScrollRegion.VisibleRows.Count to determine how many rows you should loop through, as that is the number of rows that should be in view at a particular time.