Adding a new line to the correct position for a user sorted by wings with anchor

I have an Infragistics UltraGrid using bindingSource.

If I add a new object to the binding list, it will add a line to the bottom of the grid, which will be fine if there is no user-defined sorting.

Question: if the user clicks on the column heading to sort the grid, is there a way for new rows to appear in the correct sort order, and not always at the bottom?

Re-sorting all the rows on each insert is too expensive.

+3
source share
1 answer

, . Infragistics , RefreshSortPosition() .

// Add to binding list which will trigger a row to be added to the bound ultragrid.
this.bindingList.Add(new Person("Smith", "John"));

// Get length since we know this will always be added to the end
int length = this.ultraGrid.Rows.All.Length;

// Get it to sort
this.ultraGrid.Rows[length - 1].RefreshSortPosition();

, , .., ..

, . .

+8

Source: https://habr.com/ru/post/1704974/


All Articles