检测Windows 8 Store App是否具有触摸屏 [英] Detect whether a Windows 8 Store App has a touch screen
问题描述
Win 8 Store App UI的某些元素会根据用户是否有触摸屏而更改.例如,当ScrollViewer在非触摸屏上呈现时,它会显示垂直滚动条.在触摸屏上,滚动条被隐藏.
There are certain elements of Win 8 Store App UI that change based on whether the user has a touch screen. For example, a ScrollViewer, when rendered on a non-touch screen shows a vertical scrollbar. On a touch screen, the scrollbar is hidden.
我想为非触摸屏用户量身定制应用程序UI,添加其他控件.有谁知道是否可以检测用户是否有触摸屏?
I would like to tailor my application UI, adding extra controls, for non-touch screen users. Does anyone know if it is possible to detect whether a user has a touch screen?
推荐答案
您可以使用Windows.Devices.Input
命名空间来检测各种功能(触摸,键盘,鼠标等).例如, TouchCapabilities 该类具有TouchPresent
属性,您可以检查该属性是否有可用的数字转换器.
You can use the Windows.Devices.Input
namespace to detect various capabilities (touch, keyboard, mouse, etc.). For example, the TouchCapabilities class has a TouchPresent
property you could check to see if there's a digitizer available.
看看输入:设备功能示例看到他们的行动.
这篇关于检测Windows 8 Store App是否具有触摸屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!