Xamarin.Forms: 无限滚动的ListView(懒加载方式) (3)

在文件夹Views中分别添加SingleViewPage和GroupViewPage内容页。直接在下面图片中修改文件名即可。

Xamarin.Forms: 无限滚动的ListView(懒加载方式)

SingleViewPage页面布局

<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="XFInfiniteScroll.Views.SingleViewPage" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:extended="clr-namespace:Xamarin.Forms.Extended;assembly=Xamarin.Forms.Extended.InfiniteScrolling" BackgroundColor="Red"> <ContentPage.Content> <ListView x:Name="ListSingleItems" HasUnevenRows="True" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <ListView.Behaviors> <extended:InfiniteScrollBehavior IsLoadingMore="{Binding IsWorking}"> </extended:InfiniteScrollBehavior> </ListView.Behaviors> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Padding="12"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Label Grid.Row="0" Text="{Binding Text}"> </Label> <Label Grid.Row="1" Text="{Binding Description}"> </Label> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> <ListView.Footer> <Grid Padding="6"> <Label HorizontalOptions="Center" IsVisible="{Binding IsWorking}" Text="Loading..." VerticalOptions="Center"> </Label> </Grid> </ListView.Footer> </ListView> </ContentPage.Content> </ContentPage>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wppxpy.html