Windows 10 UWP: Undo / Redo Ink with Surface Dial

The Surface Dial is the first wheel device in a new input device class. I got my hand on one as soon as it came to market in China.

I have a UWP App named "Image Portray", as a drawing app that can make use of the Surface Dial. One of it's useful application to undo / redo the ink by turning the Surface Dial. You can download it from Windows Store these days to see the changes.

So, let's begin with some basics of the Surface Dial. If you haven't used one yet, it is basically a bluetooth device that will pair with any Windows 10 desktop machine, Windows will handle default menu items, and you can modify custom tools in Windows Settings.

But for particular UWP Apps, developers are allowed to add app sepecific tools to the Surface Dial menu, or hiding the system default menu is also supportted. Some UWP controls by default has support for Surface Dial, like the InkToolbar:

The args.RotationDeltaInDegrees < 0 means, user is rotating the Dial to left, we will perform an Undo operation for that. If the value is > 0, user is rotating the Dial to right, then perform a Redo operation.

For the logic in UndoLastStorke() and RedoLastStorke(), please check my previous blog post: