Skip to content

Commit efbd661

Browse files
WinUI - C# syntax updates
1 parent a44dd16 commit efbd661

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

4_Apps/Windows/LayoutSamples/LayoutSamples/LayoutSamples.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
44
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
@@ -25,8 +25,8 @@
2525
</ItemGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" />
29-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
28+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
29+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
3030
<Manifest Include="$(ApplicationManifest)" />
3131
</ItemGroup>
3232

4_Apps/Windows/LayoutSamples/LayoutSamples/Views/VariableSizedWrapGridPage.xaml.cs

+7-8
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ public sealed partial class VariableSizedWrapGridPage : Page
1616

1717
protected override void OnNavigatedTo(NavigationEventArgs e)
1818
{
19-
Random r = new();
20-
Grid[] items =
21-
Enumerable.Range(0, 30).Select(i =>
19+
Grid[] items = [..
20+
Enumerable.Range(1, 30).Select(i =>
2221
{
2322
byte[] colorBytes = new byte[3];
24-
r.NextBytes(colorBytes);
23+
Random.Shared.NextBytes(colorBytes);
2524
Rectangle rect = new()
2625
{
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),
2928
Fill = new SolidColorBrush(new Color
3029
{
3130
R = colorBytes[0],
@@ -36,15 +35,15 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
3635
};
3736
TextBlock textBlock = new()
3837
{
39-
Text = (i + 1).ToString(),
38+
Text = i.ToString(),
4039
HorizontalAlignment = HorizontalAlignment.Center,
4140
VerticalAlignment = VerticalAlignment.Center
4241
};
4342
Grid grid = new();
4443
grid.Children.Add(rect);
4544
grid.Children.Add(textBlock);
4645
return grid;
47-
}).ToArray();
46+
})];
4847

4948
foreach (var item in items)
5049
{

0 commit comments

Comments
 (0)