Determine if the Windows 8 Store app has a touch screen

There are certain user interface elements of the Win 8 Store application that change depending on whether the user has a touch screen. For example, a ScrollViewer, when rendered on a non-touching screen, displays a vertical scroll bar. The scroll bar is hidden on the touch screen.

I would like to customize the user interface of the application by adding additional controls for users who do not have a touch screen. Does anyone know if it is possible to determine if the user has a touch screen?

+5
source share
2 answers

You can use the namespace Windows.Devices.Inputto detect various capabilities (touch, keyboard, mouse, etc.). For example, the TouchCapabilities class has a property TouchPresentthat you can check to see if there is a digitizer available.

Take a look at Input: Device features sample to see them in action.

+6
source

If you use HTML / JS, you can request it like this:

var touchCapabilities = new Windows.Devices.Input.TouchCapabilities();
var isTouchCapable = touchCapabilities.touchPresent;
+2
source

All Articles