I have a WinForm DataGridView bound to a List<> of objects and I would like to set the datasource of the DataGridView to display only so many records at a time. From a few searches it looks like there is a way to do this however I have not found the exact method. Is there a way to set the total row count and then set an event that fires when more rows are needed? I am thinking that I need to do something like:
private const int AMOUNT = 1000;
private int pageCount = 0;
this.grdItems.VirtualMode = true;
// Initial Load
this.grdItems.RowCount = myList.Count();
this.grdItems.DataSource = myList.Take(AMOUNT);
// When the user scrolls to the bottom of the list
this.grdItems.DataSource = myList.Skip(pageCount++).Take(AMOUNT);