-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathWrapLayoutSample.xaml.cs
More file actions
36 lines (30 loc) · 1.36 KB
/
WrapLayoutSample.xaml.cs
File metadata and controls
36 lines (30 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// 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.
using CommunityToolkit.WinUI.Controls;
using Windows.UI;
namespace PrimitivesExperiment.Samples;
[ToolkitSampleNumericOption("HorizontalSpacing", initial: 5, min: 0, max: 200, step: 1, Title = "Horizontal Spacing")]
[ToolkitSampleNumericOption("VerticalSpacing", initial: 5, min: 0, max: 200, step: 1, Title = "VerticalSpacing")]
[ToolkitSample(id: nameof(WrapLayoutSample), "WrapLayout", description: $"A sample for showing how to create and use a {nameof(WrapLayout)}.")]
public sealed partial class WrapLayoutSample : Page
{
public ObservableCollection<ColorItem> ColorsCollection = new();
public Random random;
public WrapLayoutSample()
{
this.InitializeComponent();
random = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < random.Next(1000, 5000); i++)
{
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))
};
ColorsCollection.Add(item);
}
}
}