<!-- 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.PinterestLayoutSamplePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:controls="http://schemas.modernwpf.com/2019"
    xmlns:samples="clr-namespace:MUXControlsTestApp.Samples"
    mc:Ignorable="d"
    Background="{DynamicResource ApplicationPageBackgroundThemeBrush}">

    <Page.Resources>
        <controls:RecyclingElementFactory x:Key="elementFactory">
            <controls:RecyclingElementFactory.RecyclePool>
                <controls:RecyclePool />
            </controls:RecyclingElementFactory.RecyclePool>
            <controls:RecyclingElementFactory.Templates>
                <DataTemplate x:Key="item">
                    <UserControl
                        IsTabStop="True"
                        FocusVisualStyle="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}"
                        controls:FocusVisualHelper.UseSystemFocusVisuals="True"
                        Margin="5">
                        <Border
                            BorderThickness="1"
                            Background="LightGray"
                            Margin="5">
                            <StackPanel>
                                <Image
                                    x:Name="recipeImage"
                                    Source="{Binding ImageUri}"
                                    Width="100"
                                    Height="100" />
                                <TextBlock
                                    x:Name="recipeDescription"
                                    Text="{Binding Description}"
                                    TextWrapping="Wrap"
                                    Margin="10" />
                            </StackPanel>
                        </Border>
                    </UserControl>
                </DataTemplate>
            </controls:RecyclingElementFactory.Templates>
        </controls:RecyclingElementFactory>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel>
            <TextBox
                x:Name="tb"
                Text="10" />
            <Button
                Content="BringIntoView"
                x:Name="bringIntoView" />
        </StackPanel>
        <controls:ItemsRepeaterScrollHost
            x:Name="tracker"
            Grid.Row="1">
            <ScrollViewer>
                <controls:ItemsRepeater x:Name="repeater">
                    <controls:ItemsRepeater.Layout>
                        <samples:PinterestLayout Width="200" />
                    </controls:ItemsRepeater.Layout>
                </controls:ItemsRepeater>
            </ScrollViewer>
        </controls:ItemsRepeaterScrollHost>
    </Grid>
</controls:Page>
