<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<controls:Page
    x:Class="MUXControlsTestApp.Samples.StoreDemoPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="http://schemas.modernwpf.com/2019">

    <Page.Resources>
        <controls:RecyclePool x:Key="pool" />
        <controls:RecyclingElementFactory
            x:Key="elementFactory"
            RecyclePool="{StaticResource pool}"
            SelectTemplateKey="OnSelectTemplateKey" />
        <DataTemplate x:Key="Category">
            <StackPanel>
                <TextBlock Text="{Binding Name}" />
                <controls:ItemsRepeaterScrollHost>
                    <ScrollViewer
                        HorizontalScrollBarVisibility="Auto"
                        VerticalScrollBarVisibility="Disabled">
                        <controls:ItemsRepeater
                            ItemsSource="{Binding}"
                            ItemTemplate="{StaticResource elementFactory}"
                            HorizontalCacheLength="0"
                            VerticalCacheLength="0">
                            <controls:ItemsRepeater.Layout>
                                <controls:StackLayout Orientation="Horizontal" />
                            </controls:ItemsRepeater.Layout>
                        </controls:ItemsRepeater>
                    </ScrollViewer>
                </controls:ItemsRepeaterScrollHost>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="Item">
            <Button
                Width="100"
                Height="100"
                Content="{Binding Name}" />
        </DataTemplate>
    </Page.Resources>

    <Grid Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}">
        <controls:ItemsRepeaterScrollHost>
            <ScrollViewer>
                <controls:ItemsRepeater
                    x:Name="outerRepeater"
                    VerticalAlignment="Top"
                    ItemTemplate="{StaticResource elementFactory}"
                    HorizontalCacheLength="0"
                    VerticalCacheLength="0">
                    <controls:ItemsRepeater.Layout>
                        <controls:StackLayout Orientation="Vertical" />
                    </controls:ItemsRepeater.Layout>
                </controls:ItemsRepeater>
            </ScrollViewer>
        </controls:ItemsRepeaterScrollHost>
    </Grid>
</controls:Page>
