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
Now you'll choose a base template to take your Simple Photo gallery application multi-platform.
60
+
Now you'll choose a base template to take your Simple Photo gallery application multi-platform.
63
61
64
-
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, and it uses MVUX in place of MVVM, making it a great starting point for rapidly building real-world applications.
62
+
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, and it uses MVUX in place of MVVM, making it a great starting point for rapidly building real-world applications.
65
63
66
64
:::image type="content" source="../images/uno/uno-vsix-new-project-options.png" alt-text="Uno solution template for project startup type":::
67
65
@@ -86,11 +84,11 @@ For more information on creating the `Assets` folder and adding images to it, se
86
84
87
85
## Preparing your app
88
86
89
-
Now that you've generated the functional starting point of your multi-platform WinUI application, you can copy code into it from the desktop project.
87
+
Now that you've generated the functional starting point of your multi-platform WinUI application, you can copy code into it from the desktop project.
90
88
91
89
### Copy the view
92
90
93
-
Because Uno Platform allows you to use the XAML flavor you're already familiar with, you can copy over the same code you created in the [previous tutorial](/hub/apps/get-started/simple-photo-viewer-winui3.md).
91
+
Because Uno Platform allows you to use the XAML flavor you're already familiar with, you can copy over the same code you created in the [previous tutorial](/hub/apps/get-started/simple-photo-viewer-winui3.md).
94
92
95
93
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:
96
94
@@ -143,8 +141,10 @@ Return to the **SimplePhotos** project from the previous tutorial. In the **Solu
@@ -237,10 +237,10 @@ Uno Platform's multi-platform implementation of the controls found in the `Windo
237
237
</Page>
238
238
```
239
239
240
-
Recall that the desktop solution also had a `MainWindow.xaml.cs` file that contained code-behind which corresponds to the view. In the Uno Platform project, the code-behind for the `MainPage` view we've copied into is contained in the `MainPage.xaml.cs` file.
240
+
Recall that the desktop solution also had a `MainWindow.xaml.cs` file that contained code-behind which corresponds to the view. In the Uno Platform project, the code-behind for the `MainPage` view we've copied into is contained in the `MainPage.xaml.cs` file.
241
241
242
242
To bring this code-behind multi-platform, we should first move the following into the `MainPage.xaml.cs` file:
243
-
243
+
244
244
-`Images` property: Provides the `GridView` with an observable collection of image files
245
245
246
246
- Contents of the constructor: Calls `GetItemsAsync()` to populate the `Images` collection with items representing image files
@@ -270,9 +270,9 @@ public sealed partial class MainPage : Page
@@ -333,22 +333,27 @@ public sealed partial class MainPage : Page
333
333
> [!NOTE]
334
334
> The files in your Uno app project should use `UnoSimplePhotos` as the namespace.
335
335
336
-
So far, the files for the main view we're working with contain all the capabilities of the desktop solution. After we copy over the `ImageFileInfo.cs` model file, we will learn how to modify the desktop-oriented blocks of code for multi-platform compatibility.
336
+
So far, the files for the main view we're working with contain all the capabilities of the desktop solution. After we copy over the `ImageFileInfo.cs` model file, we will learn how to modify the desktop-oriented blocks of code for multi-platform compatibility.
337
337
338
-
Copy `ImageFileInfo` from the desktop project and paste it into the `ImageFileInfo.cs` file. Make the following changes:
338
+
Copy `ImageFileInfo` from the desktop project and paste it into the `ImageFileInfo.cs` file. Make the following changes:
339
339
340
340
- Rename the namespace to be `UnoSimplePhotos` instead of `SimplePhotos`:
Again, preprocessor directives ensure that the `ContainerContentChangingEventArgs.Phase` property is only used where it is supported. We make use of the previously unused `GetImageSourceAsync()` method to load the image files into the `GridView` on platforms other than Windows. At this point, we will accommodate the changes made above by editing the `ImageFileInfo` class.
580
+
Again, preprocessor directives ensure that the `ContainerContentChangingEventArgs.Phase` property is only used where it is supported. We make use of the previously unused `GetImageSourceAsync()` method to load the image files into the `GridView` on platforms other than Windows. At this point, we will accommodate the changes made above by editing the `ImageFileInfo` class.
576
581
577
582
### Creating a separate code path for other platforms
578
583
@@ -626,6 +631,7 @@ To prevent getting the value of `ImageProperties` when it's null, we will need t
626
631
```csharp
627
632
publicstringImageDimensions=>$"{ImageProperties?.Width} x {ImageProperties?.Height}";
@@ -902,29 +910,29 @@ Launch the `UnoSimplePhotos.Windows` target. Observe that this WinUI app is very
902
910
903
911
You can now build and run your app on any of the supported platforms. To do so, you can use the debug toolbar drop-down to select a target platform to deploy:
904
912
905
-
* To run the **WebAssembly** (Wasm) head:
906
-
- Right-click on the `UnoSimplePhotos.Wasm` project, select **Set as startup project**
907
-
- Press the `UnoSimplePhotos.Wasm` button to deploy the app
908
-
- If desired, you can add and use the `UnoSimplePhotos.Server` project as an alternative
909
-
* To debug for **iOS**:
910
-
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
911
-
- 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.
913
+
- To run the **WebAssembly** (Wasm) head:
914
+
- Right-click on the `UnoSimplePhotos.Wasm` project, select **Set as startup project**
915
+
- Press the `UnoSimplePhotos.Wasm` button to deploy the app
916
+
- If desired, you can add and use the `UnoSimplePhotos.Server` project as an alternative
917
+
- To debug for **iOS**:
918
+
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
919
+
- 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.
912
920
913
921
:::image type="content" source="../images/uno/uno-mobile-debug.png" alt-text="Visual Studio dropdown to select a target framework to deploy":::
914
922
915
-
* To debug for **Mac Catalyst**:
916
-
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
917
-
- In the debug toolbar drop-down, select a remote macOS device. You'll need to be paired with one for this to work.
918
-
* To debug the **Android** platform:
919
-
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
920
-
- In the debug toolbar drop-down, select either an active Android device or the emulator
921
-
- Select an active device in the "Device" sub-menu
922
-
* To debug on **Linux** with **Skia GTK**:
923
-
- Right-click on the `UnoSimplePhotos.Skia.Gtk` project, and select **Set as startup project**
924
-
- Press the `UnoSimplePhotos.Skia.Gtk` button to deploy the app
923
+
- To debug for **Mac Catalyst**:
924
+
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
925
+
- In the debug toolbar drop-down, select a remote macOS device. You'll need to be paired with one for this to work.
926
+
- To debug the **Android** platform:
927
+
- Right-click on the `UnoSimplePhotos.Mobile` project, and select **Set as startup project**
928
+
- In the debug toolbar drop-down, select either an active Android device or the emulator
929
+
- Select an active device in the "Device" sub-menu
930
+
- To debug on **Linux** with **Skia GTK**:
931
+
- Right-click on the `UnoSimplePhotos.Skia.Gtk` project, and select **Set as startup project**
932
+
- Press the `UnoSimplePhotos.Skia.Gtk` button to deploy the app
0 commit comments