共用方式為


Windows 上的 RefreshView 提取方向

此 通用 Windows 平台 平臺特定可讓 的提取方向RefreshView變更,以符合顯示數據之可捲動控件的方向。 將可繫結屬性設定 RefreshView.RefreshPullDirection 為 列舉值 RefreshPullDirection ,以在 XAML 中取用:

<ContentPage ...
             xmlns:windows="clr-namespace:Xamarin.Forms.PlatformConfiguration.WindowsSpecific;assembly=Xamarin.Forms.Core">
    <RefreshView windows:RefreshView.RefreshPullDirection="LeftToRight"
                 IsRefreshing="{Binding IsRefreshing}"
                 Command="{Binding RefreshCommand}">
        <ScrollView>
            ...
        </ScrollView>
    </RefreshView>
 </ContentPage>

或者,您可以使用 Fluent API 從 C# 取用它:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
...
refreshView.On<Windows>().SetRefreshPullDirection(RefreshPullDirection.LeftToRight);

RefreshView.On<Windows>方法會指定這個平臺專用只會在 通用 Windows 平台 上執行。 命名空間 RefreshView.SetRefreshPullDirection 中的 Xamarin.Forms.PlatformConfiguration.WindowsSpecific 方法可用來設定 的 RefreshView提取方向,列舉 RefreshPullDirection 提供四個可能的值:

  • LeftToRight 表示從左至右的提取起始重新整理。
  • TopToBottom 表示從上到下提取起始重新整理,而 是的預設提取方向 RefreshView
  • RightToLeft 表示從右至左的提取起始重新整理。
  • BottomToTop 表示從下到上提取會起始重新整理。

此外,GetRefreshPullDirection方法可以用來傳回 的RefreshView目前 RefreshPullDirection

結果是,指定的 RefreshPullDirection 會套用至 RefreshView,以設定提取方向以符合顯示數據之可捲動控件的方向。 下列螢幕快照顯示 RefreshView 具有提取方向的 LeftToRight

UWP 上由左至右提取方向的 RefreshView 螢幕快照

注意

當您變更提取方向時,進度圓形的開始位置會自動旋轉,讓箭號在提取方向的適當位置開始。