Load more items on grid view scroll end

我与影子孤独终老i 提交于 2019-12-17 19:31:03

问题


I am developing a Windows Store Application in XAML/C# and I have a GridView displaying 12 items at a time (3 x 4). What I need to do is once the user scrolls to the end, more items are added to the GridView. How do I catch the event for scrolling at end?? I tried many approaches, but nothing worked...

UPDATE: It took me a LOOOONG time and lots of examples to figure what I was doing wrong. ListView worked, but GridView didn't... Finally I noticed that the GridView items must have a width height in order for incremental loading to work.


回答1:


See these examples to learn how to set ObservableCollection<T> that implements the ISupportIncrementalLoading interface.

Metro: Incrementally load GridView and ListView with ISupportIncrementalLoading

From the Windows 8 Camps: GridViews/ListViews and Large Data Sets

WinRT: How to properly implement ISupportIncrementalLoading with navigation




回答2:


I would suggest that you bind your GridView to a collection that implements the ISupportIncrementalLoading interface. If you do this, the GridView can automatically load the data when the user scrolls to the end.

For a complete example on how to do this, see Microsoft's XAML data binding sample.



来源:https://stackoverflow.com/questions/17237012/load-more-items-on-grid-view-scroll-end

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