@@ -16,16 +16,15 @@ public sealed partial class VariableSizedWrapGridPage : Page
16
16
17
17
protected override void OnNavigatedTo ( NavigationEventArgs e )
18
18
{
19
- Random r = new ( ) ;
20
- Grid [ ] items =
21
- Enumerable . Range ( 0 , 30 ) . Select ( i =>
19
+ Grid [ ] items = [ ..
20
+ Enumerable . Range ( 1 , 30 ) . Select ( i =>
22
21
{
23
22
byte [ ] colorBytes = new byte [ 3 ] ;
24
- r . NextBytes ( colorBytes ) ;
23
+ Random . Shared . NextBytes ( colorBytes ) ;
25
24
Rectangle rect = new ( )
26
25
{
27
- Height = r . Next ( 40 , 150 ) ,
28
- Width = r . Next ( 40 , 150 ) ,
26
+ Height = Random . Shared . Next ( 40 , 150 ) ,
27
+ Width = Random . Shared . Next ( 40 , 150 ) ,
29
28
Fill = new SolidColorBrush ( new Color
30
29
{
31
30
R = colorBytes [ 0 ] ,
@@ -36,15 +35,15 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
36
35
} ;
37
36
TextBlock textBlock = new ( )
38
37
{
39
- Text = ( i + 1 ) . ToString ( ) ,
38
+ Text = i . ToString ( ) ,
40
39
HorizontalAlignment = HorizontalAlignment . Center ,
41
40
VerticalAlignment = VerticalAlignment . Center
42
41
} ;
43
42
Grid grid = new ( ) ;
44
43
grid . Children . Add ( rect ) ;
45
44
grid . Children . Add ( textBlock ) ;
46
45
return grid ;
47
- } ) . ToArray ( ) ;
46
+ } ) ] ;
48
47
49
48
foreach ( var item in items )
50
49
{
0 commit comments