page_type: sample languages:
The Photo Editor application is a Universal Windows Platform (UWP) sample that showcases development with the C++/WinRT language projection. The sample application allows you to retrieve photos from the Pictures library, and then edit the selected image with assorted photo effects. In the sample's source code, you'll see a number of common practices—such as data binding, and asynchronous actions and operations—performed using the C++/WinRT projection.
Note - This sample is targeted and tested for Windows 10, version 2004 (10.0; Build 19041), and Visual Studio 2019. If you prefer, you can use project properties to retarget the project(s) to Windows 10, version 1903 (10.0; Build 18362).
Photo Editor primarily demonstrates:
You can optionally install the C++/WinRT Visual Studio Extension (VSIX). When you open the project, it will install the Microsoft.Windows.CppWinRT NuGet package.
To get the latest updates to Windows and the development tools, and to help shape their development, join the Windows Insider Program.
The default project is PhotoEditor and you can Start Debugging (F5) or Start Without Debugging (Ctrl+F5) to try it out, just make sure to set the platform target appropriately. The app will run in the emulator or on physical devices.
If you're just interested in code snippets for certain areas, and don't want to browse or run the full sample, check out the following files.
A custom runtime class that represents a photo.
The first page that loads the photos from the Pictures Library and displays a tiled thumbnail view.
Tapping a photo from the MainPage thumbnail view will take you to the photo editor page, where Win2D effects are toggled, set, and chained together.
If you build the project on a given target platform version (TargetPlatformVersion
in the project file), and then you retarget and rebuild, you may see this error message in Visual Studio: "error MIDL2003: [msg]redefinition [context]:
\Windows-appsample-photo-editor\PhotoEditor\<CONFIGURATION>\XamlMetaDataProvider.idl
, and rebuilding.