首页 > 解决方案 > 如何让活动指示器在集合视图的底部运行以指示正在加载更多项目?

问题描述

我想知道如何在 Xamarin Forms 的集合视图的页脚中添加一个活动指示器,以显示正在从服务器获取更多项目。

XAML

<CollectionView Grid.Row="1" x:Name="Posts" SelectionMode="Single" SelectionChanged="Posts_SelectionChanged" RemainingItemsThreshold="5" RemainingItemsThresholdReached="Posts_RemainingItemsThresholdReached">
  <CollectionView.ItemTemplate>
        <DataTemplate>
            <StackLayout Padding="8, 8, 8, 0">
                // Some XAML
            </StackLayout>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

标签: xamarinxamarin.formscollectionviewactivity-indicator

解决方案


尝试在 CollectionView 中将阈值与活动指示器一起使用,并在对数据设置阈值时为活动指示器设置 IsVisible 等于 true。


推荐阅读