Did you know there are different types of pens, two main ones? One that is considered as touch and one as pen?
Let’s take a step back and get some basics down.
Responding to user interaction in Windows Store Apps is very easy. Reacting, filtering and responding to user interaction. Since Windows Store Apps are touch first the mouse events we are used to have been replaced by lower level gestures that more or less correspond to the traditional mouse input events. These are called the Pointer events and they work just as well with mouse, touch or pen/stylus. But how do you know what was used?
Identifying pointer devices
Here is an example of how you can retrieve information about the pointer device:
Getting the type:
private void RecAOnPointerPressed(object sender, PointerRoutedEventArgs e)
feedback.Text = e.Pointer.PointerDeviceType.ToString();
private void RecBOnPointerPressed(object sender, PointerRoutedEventArgs e)
if (e.Pointer.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Pen) return;
feedback.Text = "You just clicked with mouse or touch";
What you must know about pen
While a Mouse device is just that, and Touch is also fairly straight forward, there are two types of pens! One that registers as touch and one that registers as a pen. To take full advantage of the pen capabilities the user needs to have a device that has an attached digitizer that accepts pen input. Therefore, to no surprise, there are different types of pens – in particular two main types:
- Active Stylus input for resistive digitizers
- Passive stylus input for capacitive digitizers
The passive stylus types are basically just elongating you finger, when they touch the surface that is how they are registered, as a finger.
The ink platform in Windows 8, if you want to create an app that takes advantage of the ink functionality don’t forget to think about these things.