Coloring Book UWP app sample
A mini-app that explores Windows Ink and Monetization features using the Windows Store. Specifically, it allows users to purchase coloring page collections and then color with Windows Ink. This sample runs on the Universal Windows Platform (UWP).
Coloring Book demonstrates:
- Using the Windows.Services.Store API for managing in-app purchases
- Customizing Windows Ink experiences with custom tools and pages
- Saving Windows Ink onto an image
- Manipulating Windows Ink with other files to save, open, export, share, and print
This sample requires Visual Studio 2015 and the Windows Software Development Kit (SDK) for Windows 10 Anniversary. Get a free copy of Visual Studio 2015 Community Edition with support for building UWP apps. Additionally, to be informed of the latest updates to Windows and the development tools, join the Windows Insider Program.
Running the sample
The default project is ColoringBook, and you can Start Debugging (F5) or Start Without Debugging (Ctrl+F5) to try it out. The app will run in the emulator or on physical devices.
To enable the in-app purchases code:
- Follow the instructions to test in-app purchases to get a Package.StoreAssociation.
- Add storeIds in Constants.cs
- #define STOREASSOCIATION in PickColoringPage.cs
Code at a glance
If you’re just interested in code snippets for certain API and don’t want to browse or run the full sample, check out the following files for examples of some highlighted features:
- PickColoringPage.xaml.cs verifies if the coloring page collection has been purchased, and if not, allows the user to purchase the collection.
- Constants.cs maintains a dictionary of the storeIds associated the coloring page collections.
- ColoringPage.xaml.cs handles all Windows Ink data and actions.
- ColoringPage.xaml contains the layout of a coloring page.
- MarkerPen.cs defines a pen that draws as a highlighter.
- PrintSample is slightly modified from the Windows Printing Sample – ColoringPage sends PhotoPrintHelper a stream to print.