Share via


ItemsRepeaterScrollHost Class

Definition

A helper to coordinate interaction between the ItemsRepeater and ScrollViewer. Use the ItemsRepeaterScrollHost if your app will run on versions of Windows prior Windows 10 1809 (Build 17763). If your app will only run on versions of Windows 1809 or higher, there is no need to use this control.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

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
Inheritance
ItemsRepeaterScrollHost
Attributes

Examples

Tip

For more info, design guidance, and code examples, see ItemsRepeater.

The WinUI 3 Gallery and WinUI 2 Gallery apps include interactive examples of most WinUI 3 and WinUI 2 controls, features, and functionality.

If installed already, open them by clicking the following links: WinUI 3 Gallery or WinUI 2 Gallery.

If they are not installed, you can download the WinUI 3 Gallery and the WinUI 2 Gallery from the Microsoft Store.

You can also get the source code for both from GitHub (use the main branch for WinUI 3 and the winui2 branch for WinUI 2).

This example shows a scrollable list of people.

<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

Remarks

ItemsRepeaterScrollHost is a helper class that you can use to wrap a ScrollViewer and provide functionality of new APIs on earlier versions of Windows 10.

Starting in Windows 10, version 1809 (SDK 17763), ScrollViewer has properties that coordinate interaction between an ItemsRepeater and the ScrollViewer. If your app targets versions of Windows 10 prior to version 1809 (SDK 17763), wrap your ScrollViewer in an ItemsRepeaterScrollHost to provide the functionality of these APIs. The properties on ItemsRepeaterScrollHost replicate the same functionality and behavior as the like-named ones found on on ScrollViewer.

If the minimum target version of your app is Windows 10, version 1809 (SDK 17763) or later, there is no need to use this control.

Constructors

ItemsRepeaterScrollHost()

Initializes a new instance of the ItemsRepeaterScrollHost class.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Properties

CurrentAnchor

The currently chosen anchor element to use for scroll anchoring.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

HorizontalAnchorRatio

Determines the horizontal position of the ScrollViewer's anchor point with respect to the viewport. By default, the ScrollViewer selects an element as its CurrentAnchor by identifying the element in its viewport nearest to the anchor point.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

ScrollViewer

Gets or sets the ScrollViewer to host.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

VerticalAnchorRatio

Determines the vertical position of the ScrollViewer's anchor point with respect to the viewport. By default, the ScrollViewer selects an element as its CurrentAnchor by identifying the element in its viewport nearest to the anchor point.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Applies to