Windows 8 WinRT KeyboardCapabilities.KeyboardPresent is always true

We use KeyboardCapabilities.KeyboardPresent to check if the keyboard is connected to the device:

bool hasKeyboard = new KeyboardCapabilities().KeyboardPresent == 1; 

Unfortunately, it is always TRUE, regardless of whether the Bluetooth keyboard is connected or not. We tried it with the following equipment:

The Dell Vostro 470 is a desktop PC with a Bluetooth wireless keyboard that has power on / off options. http://www.dell.com/in/business/p/vostro-470/pd

Samsung 700T Notebook (Slate) http://www.samsung.com/uk/consumer/pc-peripherals/slate-pc/slate-pc/XE700T1A-A01UK

Disabling the keyboard, Bluetooth, removing the keyboard from the list of devices, etc. did not help, KeyboardCapabilities.KeyboardPresent always returns 1.

Are we missing something or is there an API that we should use instead to detect such changes?

+4
source share
2 answers

I have the same behavior on my tablet. Maybe a mistake ...

A more complicated solution is to list device containers. It will tell you if any keyboard is connected. For more information, see Example device enumeration .

+1
source

Also, having this problem, on my Microsoft Surface (which has a removable keyboard), KeyboardPresent always returns “1”, even if no keyboard (touch / type cover) is connected, and we have an open soft keyboard.

+1
source

Source: https://habr.com/ru/post/1439176/


All Articles