Determine metro app is running in Windows 8 tab or Desktop PC

前端 未结 3 1156
孤独总比滥情好
孤独总比滥情好 2020-12-06 02:06

I am developing app with windows 8 metro style. This app has some more feature if it running in desktop pc compared to Tablet. But my problem is how to detect app is running

3条回答
  •  悲哀的现实
    2020-12-06 02:11

    Windows.Devices namespace has a wealth of information about device capabilities. For example to determine if the device is touch enabled, you can use:

    var hasTouch = Windows.Devices.Input
                      .PointerDevice.GetPointerDevices()
                      .Any(p => p.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Touch);
    

提交回复
热议问题