Lazy loading with wpf Data Grid

心不动则不痛 提交于 2019-12-12 19:15:56

问题


Initially I am populating 100 rows in Data grid, when user scroll the grid rows, I want to populate another 100 rows. I am using wpf data grid, I have not found any event of data grid that I can catch to accomplish this task. Then I have used scroll viewer control and try to catch change event where I know that my scroll viewer reach at end, then I will load another rows in data grid.

 <ScrollViewer Name="svDataGrid" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" ScrollChanged="ScrollViewer_ScrollChanged" >
            <DataGrid VerticalScrollBarVisibility="Disabled"   Background="Transparent" Visibility="Collapsed" Name="dgList" Grid.Row="1" IsSynchronizedWithCurrentItem="True"
                 AutoGenerateColumns="False" AlternatingRowBackground="Azure"
                 CanUserAddRows="False" CanUserDeleteRows="False"
                 CanUserSortColumns="True" CanUserReorderColumns="False"
                 CanUserResizeColumns="True" CanUserResizeRows="False" IsReadOnly="True" MouseDoubleClick="dgList_MouseDoubleClick"  PreviewKeyDown="dgList_PreviewKeyDown">
            </DataGrid>
        </ScrollViewer>

any suggestion or hint appreciated.

Thanks


回答1:


You should be looking at data virtulization.

Please refer http://bea.stollnitz.com/blog/?p=344



来源:https://stackoverflow.com/questions/3939543/lazy-loading-with-wpf-data-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!