c# - Implementing LoadMore pagination for a grouped ListView in Windows Phone 8.1? -
is possible apply listviewbase.loadmoreitemsasync method pagination in grouped listview (collectionviewsource). or maybe know way, please let me know.
you can this: on listview add "loaded" event code:
private void lvpictures_onloaded(object sender, routedeventargs e) { scrollviewer viewer = getscrollviewer(this.lvpictures); viewer.viewchanged += lvpictures_viewchanged; } public static scrollviewer getscrollviewer(dependencyobject depobj) { if (depobj scrollviewer) return depobj scrollviewer; (int = 0; < visualtreehelper.getchildrencount(depobj); i++) { var child = visualtreehelper.getchild(depobj, i); var result = getscrollviewer(child); if (result != null) return result; } return null; }
and in viewchangeevent can specify when want load more items , this:
private async void lvpictures_viewchanged(object sender, scrollviewerviewchangedeventargs e) { scrollviewer view = (scrollviewer)sender; double progress = view.verticaloffset / view.scrollableheight; if (progress > 0.8 & !_incallfileslist && nextpagepicturesavailable) { _incallfileslist = true; getnextpicturespageasync(); } _incallfileslist = false; }
Comments
Post a Comment