Skip to content

Commit 417ee66

Browse files
committed
Changed Binding to x:Bind in WrapLayoutSample DataTemplates
1 parent e24000f commit 417ee66

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

components/Primitives/samples/WrapLayoutSample.xaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,29 @@
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" x:DataType="local:ColorItem">
14+
<Border Width="{x:Bind Width}"
1515
Height="48"
1616
CornerRadius="{StaticResource ControlCornerRadius}">
1717
<Border.Background>
18-
<SolidColorBrush Color="{Binding Color}" />
18+
<SolidColorBrush Color="{x:Bind Color}" />
1919
</Border.Background>
2020
<TextBlock Margin="6,4,4,4"
2121
FontSize="16"
22-
Text="{Binding Index}" />
22+
Text="{x:Bind Index}" />
2323
</Border>
2424
</DataTemplate>
2525
</Page.Resources>
2626

2727
<Grid>
28-
<ScrollViewer x:Name="WrapScrollParent">
29-
<muxc:ItemsRepeater x:Name="WrapRepeater"
28+
<muxc:ItemsRepeater x:Name="WrapRepeater"
3029
ItemTemplate="{StaticResource WrapTemplate}"
3130
ItemsSource="{x:Bind ColorsCollection, Mode=OneWay}">
32-
<muxc:ItemsRepeater.Layout>
33-
<controls:WrapLayout x:Name="Wrap"
31+
<muxc:ItemsRepeater.Layout>
32+
<controls:WrapLayout x:Name="Wrap"
3433
HorizontalSpacing="{x:Bind HorizontalSpacing, Mode=OneWay}"
3534
VerticalSpacing="{x:Bind VerticalSpacing, Mode=OneWay}" />
36-
</muxc:ItemsRepeater.Layout>
37-
</muxc:ItemsRepeater>
38-
</ScrollViewer>
35+
</muxc:ItemsRepeater.Layout>
36+
</muxc:ItemsRepeater>
3937
</Grid>
4038
</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)