Skip to content

Commit cd04e56

Browse files
Merge pull request #3643 from MicrosoftDocs/alvinashcraft-main-fixes-for-uno-file-viewer-tutorial
Fix up issues in the cross-platform Uno simple photo viewer PR
2 parents 5f75feb + ab604d5 commit cd04e56

8 files changed

+28
-18
lines changed

hub/apps/get-started/simple-photo-viewer-winui3.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,3 +963,7 @@ The **Images** property value doesn't change at run-time for this particular app
963963
## Conclusion
964964
965965
In this tutorial we walked through the process of using Visual Studio to build a simple WinUI 3 app that displays photos. Hopefully this tutorial has given you experience working in a WinUI 3 app with controls, layout panels, data-binding, and GridView UI optimization.
966+
967+
## See also
968+
969+
[Tutorial: Build a simple photo viewer that targets multiple platforms](uno-simple-photo-viewer.md)

hub/apps/get-started/uno-simple-photo-viewer.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,32 @@ ms.localizationpriority: medium
1111

1212
# Tutorial: Build a simple photo viewer that targets multiple platforms
1313

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 uses [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 can run a pixel-perfect copy of the app ported to these platforms.
14+
After you've [created](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 uses [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 can run a pixel-perfect copy of the app ported to these platforms.
1515

16-
:::image type="content" source="images/uno/screenshot1.png" alt-text="Screenshot of UnoSimplePhoto app targeting web and WinUI desktop":::
16+
:::image type="content" source="images/uno/uno-simple-photo-viewer-apps.png" alt-text="Screenshot of UnoSimplePhoto app targeting web and WinUI desktop.":::
1717

1818
## Prerequisites
1919

2020
- [Visual Studio 2022 17.4 or later](https://visualstudio.microsoft.com/#vs-section)
2121
- [Tools for Windows App SDK](../windows-app-sdk/set-up-your-development-environment.md)
2222
- ASP.NET and web development workload (for WebAssembly development)
23-
:::image type="content" source="../images/uno/uno-vs-install-web.png" alt-text="Web development workload in VS":::
23+
:::image type="content" source="../images/uno/uno-vs-install-web.png" alt-text="Screenshot of the web development workload in Visual Studio.":::
2424
- .NET Multi-platform App UI development installed (for iOS, Android, Mac Catalyst development).
25-
:::image type="content" source="../images/uno/uno-vs-install-dotnet-mobile.png" alt-text="dotnet mobile workload in VS":::
25+
:::image type="content" source="../images/uno/uno-vs-install-dotnet-mobile.png" alt-text="Screenshot of the dotnet mobile workload in Visual Studio.":::
2626
- .NET desktop development installed (for Gtk, Wpf, and Linux Framebuffer development)
27-
:::image type="content" source="../images/uno/uno-vs-install-dotnet.png" alt-text="dotnet desktop workload in VS":::
27+
:::image type="content" source="../images/uno/uno-vs-install-dotnet.png" alt-text="Screenshot of the dotnet desktop workload in Visual Studio.":::
2828

2929
[!INCLUDE [uno-setup.md](../../includes/uno-setup.md)]
3030

3131
## Install the Uno Platform solution templates
3232

3333
Launch Visual Studio, then click `Continue without code`. Click `Extensions` -> `Manage Extensions` from the Menu Bar.
3434

35-
:::image type="content" source="../images/uno/uno-manage-extensions.png" alt-text="Visual Studio Menu bar item that reads manage extensions":::
35+
:::image type="content" source="../images/uno/uno-manage-extensions.png" alt-text="Screenshot of the Visual Studio Menu bar item that reads manage extensions.":::
3636

3737
In the Extension Manager expand the **Online** node and search for `Uno`, install the `Uno Platform` extension, or download and install it from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=unoplatform.uno-platform-addin-2022), then restart Visual Studio.
3838

39-
:::image type="content" source="../images/uno/uno-extensions.png" alt-text="Manage Extensions window in Visual Studio with Uno Platform extension as a search result":::
39+
:::image type="content" source="../images/uno/uno-extensions.png" alt-text="Screenshot of the manage Extensions window in Visual Studio with Uno Platform extension as a search result.":::
4040

4141
## Create an application
4242

@@ -46,38 +46,38 @@ Soon enough, you will be able to reap the benefits of this approach, as you can
4646

4747
Open Visual Studio and create a new project via `File` > `New` > `Project`:
4848

49-
:::image type="content" source="../images/uno/uno-create-project.png" alt-text="Create a new project":::
49+
:::image type="content" source="../images/uno/uno-create-project.png" alt-text="Screenshot of the create a new project dialog.":::
5050

5151
Search for Uno and select the Uno Platform App project template:
5252

53-
:::image type="content" source="../images/uno/uno-new-project.png" alt-text="Uno platform app":::
53+
:::image type="content" source="../images/uno/uno-new-project.png" alt-text="Screenshot of the create a new project dialog with Uno Platform app as the selected project type.":::
5454

5555
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:
5656

57-
:::image type="content" source="images/uno/uno-configure-project.png" alt-text="Specify project details":::
57+
:::image type="content" source="images/uno/uno-configure-project.png" alt-text="Screenshot of specifying project details for the new Uno Platform project.":::
5858

5959
Now you'll choose a base template to take your Simple Photo gallery application multi-platform.
6060

6161
The Uno Platform App template comes with two preset options that allow you to quickly get started with either a **Blank** solution or the **Default** configuration which includes references to the Uno.Material and Uno.Toolkit libraries. The Default configuration also includes Uno.Extensions which is used for dependency injection, configuration, navigation, and logging. In addition, it uses MVUX in place of MVVM, making it a great starting point for rapidly building real-world applications.
6262

63-
:::image type="content" source="../images/uno/uno-vsix-new-project-options.png" alt-text="Uno solution template for project startup type":::
63+
:::image type="content" source="../images/uno/uno-vsix-new-project-options.png" alt-text="Screenshot of the Uno solution template for project startup type.":::
6464

6565
To keep things simple, select the **Blank** preset. Then, click the **Create** button. Wait for the projects to be created and their dependencies to be restored.
6666

6767
A banner at the top of the editor may ask to reload projects, click **Reload projects**:
68-
:::image type="content" source="../images/vs2022-project-reload.png" alt-text="Visual Studio banner offering to reload your projects to complete changes":::
68+
:::image type="content" source="../images/visual-studio-2022-project-reload.png" alt-text="Screenshot of the Visual Studio banner offering to reload your projects to complete changes.":::
6969

7070
You should see the following default file structure in your **Solution Explorer**:
7171

72-
:::image type="content" source="images/uno/screenshot2.png" alt-text="Default file structure":::
72+
:::image type="content" source="images/uno/solution-explorer-new-uno-project.png" alt-text="Screenshot of the default file structure in Solution Explorer.":::
7373

7474
### Add image assets to the project
7575

7676
Your app will need some images to display. You can use the same images from the previous tutorial.
7777

7878
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:
7979

80-
:::image type="content" source="images/uno/screenshot3.png" alt-text="Solution explorer pane in Visual Studio":::
80+
:::image type="content" source="images/uno/solution-explorer-uno-project-new-files.png" alt-text="Screenshot of the Solution Explorer pane in Visual Studio with the new files and folders added.":::
8181

8282
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).
8383

@@ -87,7 +87,7 @@ Now that you've generated the functional starting point of your multi-platform W
8787

8888
### Copy the view
8989

90-
Because Uno Platform allows you to use the XAML flavor you're already familiar with, you can copy the same code over that you created in the [previous tutorial](/hub/apps/get-started/simple-photo-viewer-winui3.md).
90+
Because Uno Platform allows you to use the XAML flavor you're already familiar with, you can copy the same code over that you created in the [previous tutorial](simple-photo-viewer-winui3.md).
9191

9292
Return to the **SimplePhotos** project from the previous tutorial. In the **Solution Explorer**, find the file named `MainWindow.xaml` and open it. Observe that the contents of the view are defined within a `Window` element rather than a `Page`. This is because the desktop project is a WinUI 3 application, which can use `Window` elements to define the contents of the view:
9393

@@ -511,7 +511,7 @@ Similar to the `GetItemsAsync` method, this method now uses a preprocessor direc
511511

512512
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'll need to make changes to this method to make it compatible with them.
513513

514-
:::image type="content" source="images/uno/xaml-attached-layout-realizationrect.png" alt-text="Diagram of collection control viewport":::
514+
:::image type="content" source="images/uno/xaml-attached-layout-realization-rect.png" alt-text="Diagram of collection control viewport.":::
515515

516516
For instance, the `ContainerContentChangingEventArgs.Phase` property is currently unsupported on platforms other than Windows. We'll 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:
517517

@@ -917,7 +917,7 @@ You can now build and run your app on any of the supported platforms. To do so,
917917
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
918918
- 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.
919919

920-
:::image type="content" source="../images/uno/uno-mobile-debug.png" alt-text="Visual Studio dropdown to select a target framework to deploy":::
920+
:::image type="content" source="../images/uno/uno-mobile-debug.png" alt-text="Screenshot of the Visual Studio dropdown to select a target framework to deploy.":::
921921

922922
- To debug for **Mac Catalyst**:
923923
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
@@ -934,4 +934,4 @@ You can now build and run your app on any of the supported platforms. To do so,
934934

935935
- [Uno Platform documentation](https://platform.uno/docs/articles/intro.html)
936936
- [Update ListView and GridView items progressively](/windows/uwp/debug-test-perf/optimize-gridview-and-listview#update-listview-and-gridview-items-progressively)
937-
- [Simple photo viewer tutorial](../get-started/simple-photo-viewer-winui3.md)
937+
- [Simple photo viewer tutorial](simple-photo-viewer-winui3.md)

hub/includes/uno-setup.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
ms.topic: include
3+
author: alvinashcraft
4+
ms.author: aashcraft
5+
ms.date: 06/14/2023
6+
---
17
## Finalize your environment
28

39
1. Open a command-line prompt, Windows Terminal if you have it installed, or else Command Prompt or Windows Powershell from the Start Menu.

0 commit comments

Comments
 (0)