Skip to content

Commit b6a8806

Browse files
authored
Merge branch 'main' into settings_expand_flip
2 parents 676c27b + 127413c commit b6a8806

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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. -->
22
<Page x:Class="PrimitivesExperiment.Samples.WrapLayoutSample"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -10,31 +10,30 @@
1010
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
1111
mc:Ignorable="d">
1212
<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}"
1516
Height="48"
1617
CornerRadius="{StaticResource ControlCornerRadius}">
1718
<Border.Background>
18-
<SolidColorBrush Color="{Binding Color}" />
19+
<SolidColorBrush Color="{x:Bind Color}" />
1920
</Border.Background>
2021
<TextBlock Margin="6,4,4,4"
2122
FontSize="16"
22-
Text="{Binding Index}" />
23+
Text="{x:Bind Index}" />
2324
</Border>
2425
</DataTemplate>
2526
</Page.Resources>
2627

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>
4039
</Page>

‎components/Primitives/samples/WrapLayoutSample.xaml.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ public WrapLayoutSample()
2323
random = new Random(DateTime.Now.Millisecond);
2424
for (int i = 0; i < random.Next(1000, 5000); i++)
2525
{
26-
var item = new ColorItem { Index = i, Width = random.Next(50, 250), Height = random.Next(50, 250), Color = Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255)) };
26+
var item = new ColorItem
27+
{
28+
Index = i,
29+
Width = random.Next(50, 250),
30+
Height = random.Next(50, 250),
31+
Color = Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255))
32+
};
2733
ColorsCollection.Add(item);
2834
}
2935
}

0 commit comments

Comments
 (0)