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

    <Page.Resources>
        <!-- The Layout specifications used: -->
        <controls:UniformGridLayout x:Key="UniformGridLayout"
                                MinRowSpacing="8" MinColumnSpacing="8"
                                MaximumRowsOrColumns="4"/>

        <DataTemplate x:Key="SimpleElementTemplate" DataType="sys:String">
            <Grid Background="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
                Width="100"
                Height="100">
                <TextBlock Text="{Binding}" 
                    FontSize="20"/>
            </Grid>
        </DataTemplate>
    </Page.Resources>
    <StackPanel Orientation="Horizontal">
        <ScrollViewer HorizontalScrollBarVisibility="Auto" 
            AutomationProperties.Name="RepeaterScrollViewer"
            MaxHeight="500">
            <controls:ItemsRepeater x:Name="UniformGridRepeater"
                Layout="{StaticResource UniformGridLayout}"
                ItemTemplate="{StaticResource SimpleElementTemplate}"/>
        </ScrollViewer>
        <StackPanel>
            <Button AutomationProperties.Name="GetRepeaterActualHeightButton"
                    Click="GetRepeaterActualHeightButtonClick">Get actual Repeater height</Button>
            <TextBlock x:Name="RepeaterActualHeightLabel" AutomationProperties.Name="RepeaterActualHeightLabel"/>
        </StackPanel>
    </StackPanel>
</ui:Page>
