|
| 1 | +<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> |
| 2 | +<Page |
| 3 | + x:Class="MUXControlsTestApp.Samples.UniformGridLayoutDemo" |
| 4 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 5 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 6 | + xmlns:controls="using:Microsoft.UI.Xaml.Controls"> |
| 7 | + |
| 8 | + <Page.Resources> |
| 9 | + <!-- The Layout specifications used: --> |
| 10 | + <controls:UniformGridLayout x:Name="UniformGridLayout" |
| 11 | + MinRowSpacing="8" MinColumnSpacing="8" |
| 12 | + MaximumRowsOrColumns="4"/> |
| 13 | + |
| 14 | + <DataTemplate x:Key="SimpleElementTemplate" x:DataType="x:String"> |
| 15 | + <Grid Background="{ThemeResource SystemControlForegroundBaseMediumLowBrush}" |
| 16 | + Width="100" |
| 17 | + Height="100"> |
| 18 | + <TextBlock Text="{Binding}" |
| 19 | + FontSize="20"/> |
| 20 | + </Grid> |
| 21 | + </DataTemplate> |
| 22 | + </Page.Resources> |
| 23 | + <StackPanel Orientation="Horizontal"> |
| 24 | + <ScrollViewer HorizontalScrollBarVisibility="Auto" |
| 25 | + HorizontalScrollMode="Auto" |
| 26 | + IsVerticalScrollChainingEnabled="False" |
| 27 | + AutomationProperties.Name="RepeaterScrollViewer" |
| 28 | + MaxHeight="500"> |
| 29 | + <controls:ItemsRepeater x:Name="UniformGridRepeater" |
| 30 | + ItemsSource="{x:Bind collection}" |
| 31 | + Layout="{StaticResource UniformGridLayout}" |
| 32 | + ItemTemplate="{StaticResource SimpleElementTemplate}"/> |
| 33 | + </ScrollViewer> |
| 34 | + <StackPanel> |
| 35 | + <Button AutomationProperties.Name="GetRepeaterActualHeightButton" |
| 36 | + Click="GetRepeaterActualHeightButtonClick">Get actual Repeater height</Button> |
| 37 | + <TextBlock x:Name="RepeaterActualHeightLabel" AutomationProperties.Name="RepeaterActualHeightLabel"/> |
| 38 | + </StackPanel> |
| 39 | + </StackPanel> |
| 40 | +</Page> |
0 commit comments