I have a DataGridView with unbound data that contains three different DataColumns. The rows can be sorted by each column, but other than that no manipulation of the displayed data is allowed.
When I query the SelectedRows property the rows are sorted in the order I initially inserted them, and not like I expected in the currently displayed or selected order. Is there a way to change this behavior?
I don’t think there’s a one-line way to do this. You will need to redo the sort into your own list, then use IndexOf with the SelectedItems to find out the visual position.
Note the above has not been compile tested and might need some tweaking.