You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/get-started/uno-simple-photo-viewer.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Tutorial--Make a simple photo viewer that targets multiple platforms
2
+
title: Tutorial--Build a simple photo viewer that targets multiple platforms
3
3
description: Learn how to reach users on other platforms like Web, iOS, Android, and Linux with minimal changes to the C#/WinUI 3 simple photo viewer built in the previous tutorial. We'll use Uno Platform to create a new multi-platform app, which we can move code from the existing desktop project to.
4
4
ms.topic: article
5
5
ms.date: 05/21/2023
@@ -9,11 +9,12 @@ author: alvinashcraft
9
9
ms.localizationpriority: medium
10
10
---
11
11
12
-
# Tutorial: Make a simple photo viewer that targets multiple platforms
12
+
# Tutorial: Build a simple photo viewer that targets multiple platforms
13
13
14
14
After you've [created](/hub/apps/get-started/simple-photo-viewer-winui3.md) a starter simple photo viewer WinUI 3 app, you might be wondering how to reach more users without having to rewrite your app. This tutorial will use [Uno Platform](https://platform.uno/) to expand the reach of your existing C# WinUI 3 application enabling reuse of the business logic and UI layer across native mobile, web, and desktop. With only minimal changes to the simple photo viewer app, we'll be able to run a pixel-perfect copy of the app ported to platforms like the web, mobile, and desktop.
15
15
16
-
[Insert picture here]
16
+
:::image type="content" source="images/uno/screenshot1.png" alt-text="Screenshot of UnoSimplePhoto app targeting Web and WinUI desktop":::
17
+
:::image type="content" source="images/uno/screenshot4.png" alt-text="Screenshot of UnoSimplePhoto app targeting Mobile":::
17
18
18
19
## Prerequisites
19
20
@@ -24,7 +25,7 @@ After you've [created](/hub/apps/get-started/simple-photo-viewer-winui3.md) a st
24
25
- .NET Multi-platform App UI development installed (for iOS, Android, Mac Catalyst development).
25
26
:::image type="content" source="../images/uno/uno-vs-install-dotnet-mobile.png" alt-text="dotnet mobile workload in VS":::
26
27
- .NET desktop development installed (for Gtk, Wpf, and Linux Framebuffer development)
27
-
:::image type="content" source="../how-tos/images/hello-world/vs-install-dotnet.png" alt-text=".net desktop workload in VS":::
28
+
:::image type="content" source="../images/uno/uno-vs-install-dotnet.png" alt-text="dotnet desktop workload in VS":::
28
29
29
30
## Finalize your environment
30
31
@@ -49,7 +50,7 @@ After you've [created](/hub/apps/get-started/simple-photo-viewer-winui3.md) a st
49
50
50
51
Launch Visual Studio, then click `Continue without code`. Click `Extensions` -> `Manage Extensions` from the Menu Bar.
51
52
52
-
:::image type="content" source="../how-tos/images/hello-world/manage-extensions.png" alt-text="Visual Studio Menu bar item that reads manage extensions":::
53
+
:::image type="content" source="../images/uno/uno-manage-extensions.png" alt-text="Visual Studio Menu bar item that reads manage extensions":::
53
54
54
55
In the Extension Manager expand the **Online** node and search for `Uno`, install the `Uno Platform` extension, or download it from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=unoplatform.uno-platform-addin-2022), then restart Visual Studio.
55
56
@@ -71,7 +72,7 @@ Search for Uno and select the Uno Platform App project template:
71
72
72
73
Create a new C# solution using the **Uno Platform App** type from Visual Studio's **Start Page**. To avoid conflicting with the code from the previous tutorial, we'll give this solution a different name, "UnoSimplePhotos". Specify the project name, solution name, and directory. In this example, our `UnoSimplePhotos` multi-platform project belongs to a `UnoSimplePhotos` solution, which will live in C:\Projects:
Your app will need some images to display. You can use the same images from the previous tutorial.
94
95
95
96
In the `UnoSimplePhotos` project, create a new folder named `Assets` and copy the JPG image files to a `Samples` subfolder. The `Assets` folder structure should now look like this:
96
97
97
-
[Insert image here]
98
+
:::image type="content" source="images/uno/screenshot3.png" alt-text="dotnet mobile workload in VS":::
98
99
99
100
For more information on creating the `Assets` folder and adding images to it, see the Uno Platform documentation about [Assets and image display](https://platform.uno/docs/articles/features/working-with-assets.html).
100
101
@@ -522,7 +523,7 @@ Similar to the `GetItemsAsync` method, this method now uses a preprocessor direc
522
523
523
524
Controls like `GridView` allow for **progressive loading** of updated item container content as they are scrolled into the viewport. This is done by using the `ContainerContentChanging` event. In the desktop project from the previous tutorial, the `ImageGridView_ContainerContentChanging` method uses this event to load the image files into the `GridView`. Because certain aspects of this event are not supported on all platforms, we will need to make changes to this method to make it compatible with them.
524
525
525
-
[insert image here]
526
+
:::image type="content" source="images/uno/xaml-attached-layout-realizationrect.png" alt-text="Diagram of collection control viewport":::
526
527
527
528
For instance, the `ContainerContentChangingEventArgs.Phase` property is currently unsupported on platforms other than Windows. We will need to make changes to the `ImageGridView_ContainerContentChanging` method to accommodate this change. Replace the `ImageGridView_ContainerContentChanging` method in the `MainPage.xaml.cs` file with the following code:
528
529
@@ -925,7 +926,7 @@ You can now build and run your app on any of the supported platforms. To do so,
925
926
- Right-click on the `UnoSimplePhotos.Mobile` project, select **Set as startup project**
926
927
- In the debug toolbar drop-down, select an active iOS device or the simulator. You'll need to be paired with a Mac for this to work.
927
928
928
-
:::image type="content" source="../how-tos/images/hello-world/net7-ios-debug.png" alt-text="Visual Studio dropdown to select a target framework to deploy":::
929
+
:::image type="content" source="../images/uno/uno-mobile-debug.png" alt-text="Visual Studio dropdown to select a target framework to deploy":::
929
930
930
931
* To debug for **Mac Catalyst**:
931
932
- Right-click on the `UnoSimplePhotos.Mobile` project, select **Set as startup project**
0 commit comments