ItemsRepeaterScrollHost 類別

定義

協助程式,可協調 ItemsRepeaterScrollViewer之間的互動。 如果您的 app 將在 Windows 10 1809 (組建 17763) 之前的 Windows 版本上執行,請使用 ItemsRepeaterScrollHost。 如果您的 app 只會在 Windows 1809 或更高版本的版本上執行,就不需要使用此控制項。

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

public ref class ItemsRepeaterScrollHost sealed : FrameworkElement
/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
/// [Windows.Foundation.Metadata.Activatable(1)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="ScrollViewer")]
class ItemsRepeaterScrollHost final : FrameworkElement
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="ScrollViewer")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.XamlContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
class ItemsRepeaterScrollHost final : FrameworkElement
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
[Windows.Foundation.Metadata.Activatable(1)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="ScrollViewer")]
public sealed class ItemsRepeaterScrollHost : FrameworkElement
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="ScrollViewer")]
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.XamlContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public sealed class ItemsRepeaterScrollHost : FrameworkElement
Public NotInheritable Class ItemsRepeaterScrollHost
Inherits FrameworkElement
繼承
ItemsRepeaterScrollHost
屬性

範例

提示

如需詳細資訊、設計指引和程式碼範例,請參閱 ItemsRepeater

WinUI 3 資源庫WinUI 2 資源庫應用程式包含大部分 WinUI 3 和 WinUI 2 控制項、功能和功能的互動式範例。

如果已安裝,請按一下下列連結加以開啟: WinUI 3 資源庫WinUI 2 資源庫

如果未安裝,您可以從 Microsoft Store 下載 WinUI 3 資源庫WinUI 2 資源庫

您也可以從 GitHub 取得的原始程式碼 (使用 WinUI 3 的主要 分支,以及 WinUI 2) 的 winui2 分支。

此範例顯示可捲動的人員清單。

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls">

    <muxc:ItemsRepeaterScrollHost>
        <ScrollViewer>
            <muxc:ItemsRepeater ItemsSource='{x:Bind PeopleCollection}' />
        </ScrollViewer>
    </muxc:ItemsRepeaterScrollHost> 

</Page

備註

ItemsRepeaterScrollHost 是一種協助程式類別,可用來包裝ScrollViewer,並提供舊版 Windows 10上新 API 的功能。

從 Windows 10 版本 1809 (SDK 17763) 開始,ScrollViewer具有屬性,可協調 ItemsRepeater 與ScrollViewer之間的互動。 如果您的應用程式以 1809 版之前的 Windows 10 版本為目標, (SDK 17763) ,請將ScrollViewer包裝在 ItemsRepeaterScrollHost 中,以提供這些 API 的功能。 ItemsRepeaterScrollHost 上的屬性會複寫與 ScrollViewer上找到的類似名稱相同功能和行為。

如果您的應用程式的最低目標版本Windows 10 版本 1809 (SDK 17763) 或更新版本,則不需要使用此控制項。

建構函式

ItemsRepeaterScrollHost()

初始化 ItemsRepeaterScrollHost 類別的新實例。

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

屬性

CurrentAnchor

目前選擇的錨點專案,用於捲動錨定。

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

HorizontalAnchorRatio

決定 ScrollViewer 錨點 相對於檢視區的水準位置。 根據預設,ScrollViewer 會識別其檢視區最接近錨點的元素,以選取專案作為其 CurrentAnchor

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

ScrollViewer

取得或設定要裝載的 ScrollViewer

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

VerticalAnchorRatio

決定 ScrollViewer 錨點 相對於檢視區的垂直位置。 根據預設,ScrollViewer 會識別其檢視區最接近錨點的元素,以選取專案作為其 CurrentAnchor

本檔適用于 Windows 應用程式 SDK 中適用于 WinUI 的 WinUI 2 for UWP (,請參閱Windows 應用程式 SDK命名空間) 。

適用於