I fill the Datagrid with 250 rows. Once the user scrolls lower while using scrollbar (below 75% for instance), I wish to fetch the following 250 rows in the database, and so forth. The concept would be that the power grid might have countless results and that we don't wish to load all of them, before the user demands them. Can there be a current mechanism with this?
EDIT: Since there appear to become a large amount of confusion: I am not searching for the conventional data virtualization solutions, I already use them. However they all need you to specify the amount of 'virtual rows' ahead of time, which totally to pricey for me personally. Exactly why they might require for the reason that it's causes it to be a lot simpler to calculate the present page/offset/etc when you are aware the entire products within the power grid. But it's a really pricey sql-query to calculate that amount, so I wish to migrate to a different solution where I'm able to skip the COUNT() query.
EnableRowVirtualization property to
Rows will therefore be loaded when user scrolls, so just the visible rows will really be loaded
So appears like Virtualization property of DataGrid wouldn't assist you to since it takes a full data set to stay in the
To have in position an information lazy loading (See articles Data Virtualization) You are able to handle ScrollViewer.ScrollChanged event and use a classical server-side paging approach. Essentially you need to define and calculate such sings like
Sort Order in by doing this you are able to request from the database a needed data set and show it on UI. Every time when
Current Page Number or
Sort Order is altering you have to request an information increase
ItemsSource from the power grid, also possibly you have to restore Scroll Position too but I am unsure within this.
- Calculate quantity of visible products
- Perform a data request to database usign parametrized query with parameters like PageNumber, PagiSize
- Update DataGrid ItemsSource with a just loaded data products
In my opinion a primary challenge is always to calculate something of Page Size, Current Page Number. In my opinion Logical Scrolling mode would assist you in this.