We've blogged about the Surface Dial a number of times, but most of those have been on how to use the Dial in a UWP application.
What if you're writing WPF apps? Think you're out of luck?
Ricardo Pons has a great post on how you, the WPF Dev, can use the Dial in your app's too.
In this article, I will try to explain, with a simple example, how to use the new Surface Dial with WPF Applications.
Developing applications for WPF
Microsoft has published some code examples for Surface Dial that demonstrate what developers can do with this great device:
Using UWP (Universal Windows Platform) we have this code example: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/RadialController
Using Classic Desktop Apps, we have this code example: https://github.com/Microsoft/Windows-classic-samples/tree/master/Samples/RadialController
Personally, I like to develop applications for UWP apps, but I couldn’t find any decent documentation explaining how to use this device with WPF – because, in my case, I would like to integrate it to improve the UX.
So how do we do this?
First of all, we need to install the Nuget package UwpDesktop. We need to understand that there is no native support for this device. As UWP applications we will need to use Interoperability (If you want to know more about this topic you can read this great documentation). We need to create the interfaces to access to the device:
Using Surface Dial will improve the user experience of our apps – and, what’s more, we can create awesome applications for UWP Apps and Classic Desktop apps like WPF applications.
Even though we don’t have native support for Surface Dial, thanks to Interop classes and UwpDesktop Nuget Package, we can use a lot of APIs from UWP applications in our Desktop apps to potentially improve their quality.