Skip to content

Commit 1bb9161

Browse files
author
eriklimakc
committed
chore: Update CardView to Uno.Sdk 5.4
1 parent daf90e4 commit 1bb9161

13 files changed

+133
-159
lines changed

UI/CardViewMigration/CardViewMigration/CardViewMigration/App.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using Microsoft.Extensions.Logging;
31
using Uno.Resizetizer;
42

53
namespace CardViewMigration;

UI/CardViewMigration/CardViewMigration/CardViewMigration/CardViewCodePage.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
using CardViewMigration.Controls;
1+
using CardViewMigration.Controls;
22
using Microsoft.UI;
3-
using Microsoft.UI.Xaml;
4-
using Microsoft.UI.Xaml.Controls;
5-
using Microsoft.UI.Xaml.Media;
63
using Microsoft.UI.Xaml.Media.Imaging;
7-
using System;
84

95
namespace CardViewMigration;
106

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
<Page
2-
x:Class="CardViewMigration.CardViewCodePage"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:CardViewMigration"
6-
xmlns:utu="using:Uno.Toolkit.UI"
7-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
mc:Ignorable="d"
10-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
11-
utu:SafeArea.Insets="Top">
1+
<Page x:Class="CardViewMigration.CardViewCodePage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="using:CardViewMigration"
5+
xmlns:utu="using:Uno.Toolkit.UI"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
10+
utu:SafeArea.Insets="Top">
1211
</Page>

UI/CardViewMigration/CardViewMigration/CardViewMigration/CardViewMigration.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,20 @@
2626
the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
2727
must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
2828
-->
29-
<!-- <WindowsSdkPackageVersion>10.0.22621.28</WindowsSdkPackageVersion> -->
29+
30+
<!-- Uno Platform 5.4 has been updated to use WinAppSDK 1.6, which necessitates a temporary version adjustment until newer versions of .NET 8 SDKs are released. -->
31+
<!-- Comment this WindowsSdkPackageVersion line again once .NET SDK version 8.0.403 or later is available. -->
32+
<!-- For more details, refer to: https://aka.platform.uno/migrate-from-previous#uno-platform-54 -->
33+
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
3034

3135
<!--
3236
UnoFeatures let's you quickly add and manage implicit package references based on the features you want to use.
3337
https://aka.platform.uno/singleproject-features
3438
-->
3539
<UnoFeatures>
36-
Toolkit
40+
Toolkit;
41+
Mvvm;
3742
</UnoFeatures>
3843
</PropertyGroup>
3944

40-
<ItemGroup>
41-
<PackageReference Include="CommunityToolkit.Mvvm" />
42-
</ItemGroup>
43-
4445
</Project>

UI/CardViewMigration/CardViewMigration/CardViewMigration/CardViewXamlPage.xaml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,41 @@
99
mc:Ignorable="d"
1010
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1111

12-
<Grid utu:SafeArea.Insets="Top">
13-
<Grid.RowDefinitions>
14-
<RowDefinition Height="Auto" />
15-
<RowDefinition Height="*" />
16-
</Grid.RowDefinitions>
17-
<Button x:Name="BackButton"
18-
Grid.Row="0"
19-
Click="{x:Bind GoBack}"
20-
Style="{StaticResource NavigationBackButtonNormalStyle}"
21-
VerticalAlignment="Top"
22-
IsEnabled="{x:Bind Frame.CanGoBack, Mode=OneWay}"
23-
ToolTipService.ToolTip="Back" />
24-
<ScrollViewer Grid.Row="1">
25-
<StackPanel Spacing="20">
26-
<controls:CardView BorderBrush="DarkGray"
27-
CardTitle="Slavko Vlasic"
28-
CardDescription="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elit dolor, convallis non interdum."
29-
IconBackgroundBrush="SlateGray"
30-
IconImageSource="ms-appx:///Assets/user.png" />
31-
<controls:CardView BorderBrush="DarkGray"
32-
CardTitle="Carolina Pena"
33-
CardDescription="Phasellus eu convallis mi. In tempus augue eu dignissim fermentum. Morbi ut lacus vitae eros lacinia."
34-
IconBackgroundBrush="SlateGray"
35-
IconImageSource="ms-appx:///Assets/user.png" />
36-
<controls:CardView BorderBrush="DarkGray"
37-
CardTitle="Wade Blanks"
38-
CardDescription="Aliquam sagittis, odio lacinia fermentum dictum, mi erat scelerisque erat, quis aliquet arcu."
39-
IconBackgroundBrush="SlateGray"
40-
IconImageSource="ms-appx:///Assets/user.png" />
41-
<controls:CardView BorderBrush="DarkGray"
42-
CardTitle="Colette Quint"
43-
CardDescription="In pellentesque odio eget augue elementum lobortis. Sed augue massa, rhoncus eu nisi vitae, egestas."
44-
IconBackgroundBrush="SlateGray"
45-
IconImageSource="ms-appx:///Assets/user.png" />
46-
</StackPanel>
47-
</ScrollViewer>
12+
<Grid utu:SafeArea.Insets="Top">
13+
<Grid.RowDefinitions>
14+
<RowDefinition Height="Auto" />
15+
<RowDefinition Height="*" />
16+
</Grid.RowDefinitions>
17+
<Button x:Name="BackButton"
18+
Grid.Row="0"
19+
Click="{x:Bind GoBack}"
20+
Style="{StaticResource NavigationBackButtonNormalStyle}"
21+
VerticalAlignment="Top"
22+
IsEnabled="{x:Bind Frame.CanGoBack, Mode=OneWay}"
23+
ToolTipService.ToolTip="Back" />
24+
<ScrollViewer Grid.Row="1">
25+
<StackPanel Spacing="20">
26+
<controls:CardView BorderBrush="DarkGray"
27+
CardTitle="Slavko Vlasic"
28+
CardDescription="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elit dolor, convallis non interdum."
29+
IconBackgroundBrush="SlateGray"
30+
IconImageSource="ms-appx:///Assets/user.png" />
31+
<controls:CardView BorderBrush="DarkGray"
32+
CardTitle="Carolina Pena"
33+
CardDescription="Phasellus eu convallis mi. In tempus augue eu dignissim fermentum. Morbi ut lacus vitae eros lacinia."
34+
IconBackgroundBrush="SlateGray"
35+
IconImageSource="ms-appx:///Assets/user.png" />
36+
<controls:CardView BorderBrush="DarkGray"
37+
CardTitle="Wade Blanks"
38+
CardDescription="Aliquam sagittis, odio lacinia fermentum dictum, mi erat scelerisque erat, quis aliquet arcu."
39+
IconBackgroundBrush="SlateGray"
40+
IconImageSource="ms-appx:///Assets/user.png" />
41+
<controls:CardView BorderBrush="DarkGray"
42+
CardTitle="Colette Quint"
43+
CardDescription="In pellentesque odio eget augue elementum lobortis. Sed augue massa, rhoncus eu nisi vitae, egestas."
44+
IconBackgroundBrush="SlateGray"
45+
IconImageSource="ms-appx:///Assets/user.png" />
46+
</StackPanel>
47+
</ScrollViewer>
4848
</Grid>
4949
</Page>

UI/CardViewMigration/CardViewMigration/CardViewMigration/CardViewXamlPage.xaml.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Runtime.InteropServices.WindowsRuntime;
6-
using Microsoft.UI.Xaml.Controls;
7-
8-
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
9-
101
namespace CardViewMigration;
112

12-
/// <summary>
13-
/// An empty page that can be used on its own or navigated to within a Frame.
14-
/// </summary>
153
public sealed partial class CardViewXamlPage : Page
164
{
175
public CardViewXamlPage()

UI/CardViewMigration/CardViewMigration/CardViewMigration/ControlTemplatePage.xaml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<Page
2-
x:Class="CardViewMigration.ControlTemplatePage"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:CardViewMigration"
6-
xmlns:utu="using:Uno.Toolkit.UI"
7-
xmlns:controls="using:CardViewMigration.Controls"
8-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
9-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
10-
mc:Ignorable="d"
11-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1+
<Page x:Class="CardViewMigration.ControlTemplatePage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="using:CardViewMigration"
5+
xmlns:utu="using:Uno.Toolkit.UI"
6+
xmlns:controls="using:CardViewMigration.Controls"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d"
10+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1211

1312
<Page.Resources>
1413
<ResourceDictionary>
@@ -29,8 +28,7 @@
2928
HorizontalAlignment="Center"
3029
VerticalAlignment="Center" />
3130
<StackPanel Grid.Column="1">
32-
<TextBlock Text="{TemplateBinding CardTitle}"
33-
FontWeight="Bold" />
31+
<TextBlock Text="{TemplateBinding CardTitle}" FontWeight="Bold" />
3432
<TextBlock Text="{TemplateBinding CardDescription}" TextWrapping="WrapWholeWords" />
3533
</StackPanel>
3634
</Grid>
@@ -49,19 +47,19 @@
4947
ToolTipService.ToolTip="Back"/>
5048

5149
<TextBlock Text="A standard CardView control is suitable for grid layouts:"
52-
TextWrapping="WrapWholeWords"
53-
Foreground="Red"
54-
Margin="0,0,0,10" />
50+
TextWrapping="WrapWholeWords"
51+
Foreground="Red"
52+
Margin="0,0,0,10" />
5553
<controls:CardView BorderBrush="DarkGray"
5654
CardTitle="Slavko Vlasic"
5755
CardDescription="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elit dolor, convallis non interdum."
5856
IconBackgroundBrush="SlateGray"
5957
IconImageSource="ms-appx:///Assets/user.png"/>
6058
<TextBlock Text="A ControlTemplate overrides the standard view, creating a more compact view suitable for lists:"
61-
FontStyle="Italic"
62-
Foreground="Red"
63-
TextWrapping="WrapWholeWords"
64-
Margin="0,0,0,10" />
59+
FontStyle="Italic"
60+
Foreground="Red"
61+
TextWrapping="WrapWholeWords"
62+
Margin="0,0,0,10" />
6563
<controls:CardView BorderBrush="DarkGray"
6664
CardTitle="Carolina Pena"
6765
CardDescription="Phasellus eu convallis mi. In tempus augue eu dignissim fermentum. Morbi ut lacus vitae eros lacinia."

UI/CardViewMigration/CardViewMigration/CardViewMigration/ControlTemplatePage.xaml.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
using Microsoft.UI.Xaml.Controls;
2-
3-
4-
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
5-
61
namespace CardViewMigration;
72

8-
/// <summary>
9-
/// An empty page that can be used on its own or navigated to within a Frame.
10-
/// </summary>
113
public sealed partial class ControlTemplatePage : Page
124
{
135
public ControlTemplatePage()
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
<ContentControl
2-
x:Class="CardViewMigration.Controls.CardView"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:CardViewMigration.Controls"
6-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
9-
BorderThickness="1"
10-
BorderBrush="Gray"
11-
d:DesignHeight="300"
12-
d:DesignWidth="400">
1+
<ContentControl x:Class="CardViewMigration.Controls.CardView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="using:CardViewMigration.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="d"
8+
BorderThickness="1"
9+
BorderBrush="Gray"
10+
d:DesignHeight="300"
11+
d:DesignWidth="400">
1312

14-
<Border x:Name="CardBorder" DataContext="{x:Bind}"
15-
Background="{Binding CardBrush}"
16-
BorderBrush="{Binding BorderBrush}"
13+
<Border x:Name="CardBorder"
14+
DataContext="{x:Bind}"
15+
Background="{Binding CardBrush}"
16+
BorderBrush="{Binding BorderBrush}"
1717
BorderThickness="{Binding BorderThickness}"
18-
CornerRadius="5"
19-
Padding="8"
20-
VerticalAlignment="Center"
21-
HorizontalAlignment="Center">
18+
CornerRadius="5"
19+
Padding="8"
20+
VerticalAlignment="Center"
21+
HorizontalAlignment="Center">
2222
<Border.Shadow>
2323
<ThemeShadow />
2424
</Border.Shadow>
@@ -33,35 +33,35 @@
3333
<ColumnDefinition Width="200" />
3434
</Grid.ColumnDefinitions>
3535
<Border BorderBrush="{Binding BorderBrush, FallbackValue='Black'}"
36-
Background="{Binding IconBackgroundBrush, FallbackValue='Gray'}"
37-
CornerRadius="38"
38-
Height="60"
39-
Width="60"
40-
HorizontalAlignment="Center"
41-
VerticalAlignment="Center">
36+
Background="{Binding IconBackgroundBrush, FallbackValue='Gray'}"
37+
CornerRadius="38"
38+
Height="60"
39+
Width="60"
40+
HorizontalAlignment="Center"
41+
VerticalAlignment="Center">
4242
<Image Source="{Binding IconImageSource}"
4343
Margin="-20"
4444
Width="60"
4545
Height="60"
4646
Stretch="UniformToFill"/>
4747
</Border>
4848
<TextBlock Grid.Column="1"
49-
Text="{Binding CardTitle, FallbackValue='Card Title'}"
50-
FontWeight="Bold"
51-
FontSize="20"
49+
Text="{Binding CardTitle, FallbackValue='Card Title'}"
50+
FontWeight="Bold"
51+
FontSize="20"
5252
VerticalAlignment="Center"
53-
HorizontalTextAlignment="Start" />
53+
HorizontalTextAlignment="Start" />
5454
<Rectangle Grid.Row="1"
55-
Grid.ColumnSpan="2"
56-
Fill="{Binding BorderBrush, FallbackValue='Black'}"
57-
Height="2"
58-
HorizontalAlignment="Stretch" />
55+
Grid.ColumnSpan="2"
56+
Fill="{Binding BorderBrush, FallbackValue='Black'}"
57+
Height="2"
58+
HorizontalAlignment="Stretch" />
5959
<TextBlock Grid.Row="2"
60-
Grid.ColumnSpan="2"
61-
Text="{Binding CardDescription, FallbackValue='Card description text.'}"
60+
Grid.ColumnSpan="2"
61+
Text="{Binding CardDescription, FallbackValue='Card description text.'}"
6262
TextWrapping="WrapWholeWords"
63-
VerticalAlignment="Stretch"
64-
HorizontalAlignment="Stretch" />
63+
VerticalAlignment="Stretch"
64+
HorizontalAlignment="Stretch" />
6565
</Grid>
6666
</Border>
6767
</ContentControl>
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
<Page
2-
x:Class="CardViewMigration.MainPage"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:CardViewMigration"
6-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
9-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1+
<Page x:Class="CardViewMigration.MainPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="using:CardViewMigration"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="d"
8+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
109

1110
<Grid HorizontalAlignment="Center" MinWidth="200">
1211
<Grid.RowDefinitions>
1312
<RowDefinition Height="*"/>
1413
<RowDefinition Height="*"/>
1514
<RowDefinition Height="*"/>
1615
</Grid.RowDefinitions>
17-
<Button Grid.Row="0" Content="CardView XAML&#x0d;&#x0a;Create CardView items with XAML."
18-
Command="{Binding NavigateCommand}"
19-
CommandParameter="CardViewMigration.CardViewXamlPage" />
20-
<Button Grid.Row="1" Content="CardView Code&#x0d;&#x0a;Create CardView items with code."
21-
Command="{Binding NavigateCommand}"
22-
CommandParameter="CardViewMigration.CardViewCodePage" />
23-
<Button Grid.Row="2" Content="CardView ControlTemplate&#x0d;&#x0a;Use a ControlTemplate to change control appearance."
24-
Command="{Binding NavigateCommand}"
25-
CommandParameter="CardViewMigration.ControlTemplatePage" />
16+
<Button Grid.Row="0"
17+
Content="CardView XAML&#x0d;&#x0a;Create CardView items with XAML."
18+
Command="{Binding NavigateCommand}"
19+
CommandParameter="CardViewMigration.CardViewXamlPage" />
20+
<Button Grid.Row="1"
21+
Content="CardView Code&#x0d;&#x0a;Create CardView items with code."
22+
Command="{Binding NavigateCommand}"
23+
CommandParameter="CardViewMigration.CardViewCodePage" />
24+
<Button Grid.Row="2"
25+
Content="CardView ControlTemplate&#x0d;&#x0a;Use a ControlTemplate to change control appearance."
26+
Command="{Binding NavigateCommand}"
27+
CommandParameter="CardViewMigration.ControlTemplatePage" />
2628
</Grid>
2729
</Page>

0 commit comments

Comments
 (0)