1
是否有可能在分組列表視圖(CollectionViewSource)中應用ListViewBase.LoadMoreItemsAsync分頁方法。或者,也許你知道另一種方式,請讓我知道。在Windows Phone 8.1中爲分組ListView實現LoadMore分頁?
是否有可能在分組列表視圖(CollectionViewSource)中應用ListViewBase.LoadMoreItemsAsync分頁方法。或者,也許你知道另一種方式,請讓我知道。在Windows Phone 8.1中爲分組ListView實現LoadMore分頁?
你可以做到這一點是這樣的: 在您的ListView添加「裝」事件與此代碼:
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 is ScrollViewer) return depObj as ScrollViewer;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
var child = VisualTreeHelper.GetChild(depObj, i);
var result = GetScrollViewer(child);
if (result != null) return result;
}
return null;
}
,現在在ViewChangeEvent您可以指定要裝入多個項目,並真正做到這一點:
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;
}