首页 > 解决方案 > Xamarin 表单滚动不适用于表视图中的 PullToRefreshLayout

问题描述

我正在使用https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout在 XAML 中实现表视图。这是结构

 <views:BaseContentPage.Content>
        <controls:PullToRefreshLayout x:Name="PullToRefreshLayout" IsPullToRefreshEnabled="True" RefreshCommand="RefreshPatientDetailsPage" RefreshColor="{StaticResource NavigationPrimary}">            
                <StackLayout>
                <ActivityIndicator Style="{StaticResource ActivityIndicator}" IsVisible="False"></ActivityIndicator>
                <TableView x:Name="ClinicleTableView" HasUnevenRows="True">                    
                 ----------------------------------------
                 ----------------------------------------
                </TableView>
            </StackLayout>            
        </controls:PullToRefreshLayout>
    </views:BaseContentPage.Content>

当我向下滚动页面时,拉动刷新工作。但页面没有滚动。我想让页面向下滚动并在滚动完成后触发拉动刷新。怎么做?

标签: xamarinxamarin.formspull-to-refresh

解决方案


我重新安排了我的 XAML 代码,它按预期工作

<views:BaseContentPage.Content>               
   <StackLayout>
      <ActivityIndicator Style="{StaticResource ActivityIndicator}" IsVisible="False"></ActivityIndicator>
         <controls:PullToRefreshLayout x:Name="PullToRefreshLayout" IsPullToRefreshEnabled="True" RefreshCommand="RefreshPatientDetailsPage" RefreshColor="{StaticResource NavigationPrimary}">    
              <TableView x:Name="ClinicleTableView" HasUnevenRows="True">                    
                 ----------------------------------------
                 ----------------------------------------
              </TableView>
         </controls:PullToRefreshLayout>
    </StackLayout>                    
 </views:BaseContentPage.Content>

推荐阅读