Reputation: 13582
I show the next selected row on top of grid using FirstDisplayedScrollingRowIndex
property like this:
int currentIndex = dgvMain.FirstDisplayedScrollingRowIndex;
int[] highlightedArray = HighlightedRows.ToArray();
highlightedArray = highlightedArray.OrderBy(h => h).ToArray();
var next = highlightedArray.FirstOrDefault(r => r > currentIndex);
dgvMain.FirstDisplayedScrollingRowIndex = next;
but how can I show the next selected row on bottom of grid? I searched for a property but didn't find anything.
If there was a method or property which could tell me how many rows I see at a time, it would be helpful, something like:
dgvMain.FirstDisplayedScrollingRowIndex = next + dgvMain.RowsPerView;
lets say I see 10 rows per view, and I want to show 36th row on bottom of my grid, in this situation showing the 27th row (36 - 9) on top would do the trick, because there are 9 other rows (10 - upper row) below it.
Upvotes: 0
Views: 397