|
1 | | -<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> |
| 1 | +<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> |
2 | 2 | <Page x:Class="PrimitivesExperiment.Samples.WrapLayoutSample" |
3 | 3 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
4 | 4 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
10 | 10 | xmlns:muxc="using:Microsoft.UI.Xaml.Controls" |
11 | 11 | mc:Ignorable="d"> |
12 | 12 | <Page.Resources> |
13 | | - <DataTemplate x:Key="WrapTemplate"> |
14 | | - <Border Width="{Binding Width}" |
| 13 | + <DataTemplate x:Key="WrapTemplate" |
| 14 | + x:DataType="local:ColorItem"> |
| 15 | + <Border Width="{x:Bind Width}" |
15 | 16 | Height="48" |
16 | 17 | CornerRadius="{StaticResource ControlCornerRadius}"> |
17 | 18 | <Border.Background> |
18 | | - <SolidColorBrush Color="{Binding Color}" /> |
| 19 | + <SolidColorBrush Color="{x:Bind Color}" /> |
19 | 20 | </Border.Background> |
20 | 21 | <TextBlock Margin="6,4,4,4" |
21 | 22 | FontSize="16" |
22 | | - Text="{Binding Index}" /> |
| 23 | + Text="{x:Bind Index}" /> |
23 | 24 | </Border> |
24 | 25 | </DataTemplate> |
25 | 26 | </Page.Resources> |
26 | 27 |
|
27 | | - <Grid> |
28 | | - <ScrollViewer x:Name="WrapScrollParent"> |
29 | | - <muxc:ItemsRepeater x:Name="WrapRepeater" |
30 | | - ItemTemplate="{StaticResource WrapTemplate}" |
31 | | - ItemsSource="{x:Bind ColorsCollection, Mode=OneWay}"> |
32 | | - <muxc:ItemsRepeater.Layout> |
33 | | - <controls:WrapLayout x:Name="Wrap" |
34 | | - HorizontalSpacing="{x:Bind HorizontalSpacing, Mode=OneWay}" |
35 | | - VerticalSpacing="{x:Bind VerticalSpacing, Mode=OneWay}" /> |
36 | | - </muxc:ItemsRepeater.Layout> |
37 | | - </muxc:ItemsRepeater> |
38 | | - </ScrollViewer> |
39 | | - </Grid> |
| 28 | + <ScrollViewer> |
| 29 | + <muxc:ItemsRepeater x:Name="WrapRepeater" |
| 30 | + ItemTemplate="{StaticResource WrapTemplate}" |
| 31 | + ItemsSource="{x:Bind ColorsCollection, Mode=OneWay}"> |
| 32 | + <muxc:ItemsRepeater.Layout> |
| 33 | + <controls:WrapLayout x:Name="Wrap" |
| 34 | + HorizontalSpacing="{x:Bind HorizontalSpacing, Mode=OneWay}" |
| 35 | + VerticalSpacing="{x:Bind VerticalSpacing, Mode=OneWay}" /> |
| 36 | + </muxc:ItemsRepeater.Layout> |
| 37 | + </muxc:ItemsRepeater> |
| 38 | + </ScrollViewer> |
40 | 39 | </Page> |
0 commit comments