检测 flowlistview 是否已到达底部

时间:2021-01-20 15:27:49

标签: xaml xamarin.forms

我想在流列表视图到达底部时将其重新加载到我的流列表视图中。因此,我需要一个在到达结束时触发的函数。

我设置了这个流列表视图:

  <flv:FlowListView  
            Grid.Column="1"
            FlowItemAppearing="listview_allAds_FlowItemAppearing"

            FlowColumnCount="2"
            IsPullToRefreshEnabled="True"
            Refreshing="listview_allAds_Refreshing"
            Margin="0,10,0,0"
            VerticalScrollBarVisibility="Never"
            FlowItemTapped="listview_allAds_FlowItemTapped"
            HasUnevenRows="True"
            x:Name="listview_allAds" >

            <flv:FlowListView.FlowColumnTemplate>
                <DataTemplate>

                    <ContentView Padding="4,3,3,4"> <!--only way to set padding-->

                        <Frame BorderColor="#ffffff" 
                               HasShadow="True"        
                               Padding="0"
                               CornerRadius="{OnPlatform Android=5, iOS=5}">

                            <Grid ...>
                        </Frame>
                    </ContentView>
                </DataTemplate>
            </flv:FlowListView.FlowColumnTemplate>
        </flv:FlowListView>

我知道你可以用“命令”做很多事情,但我不知道该怎么做。

你能帮我吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用 FlowItemAppearing。您在代码中设置的事件运行良好。

 async void listview_allAds_ItemAppearing(object sender, ItemVisibilityEventArgs e)
    {            

        if (e.ItemIndex ==  infos.Count/2)//2 is the FlowColumnCount of your FlowListView  
        {

            await DisplayAlert("Alert", "Scrolled to the bottom", "OK");
        }
    }
相关问题