Getting the Keyboard Layout in WPF C#

前端 未结 2 883
自闭症患者
自闭症患者 2021-01-26 13:03

I need to get the Current Windows Keyboard Layout for my WPF application to map each key correctly and handle AZERTY as well as QWERTY and QWERTZ (and so on...)

I notic

2条回答
  •  猫巷女王i
    2021-01-26 13:41

    I am not sure of the ask - whether you want to know the current keyboard layout or you want to set the keyboard layout.

    In both cases, InputLanguageManager should help.

    You can try setting input language manager to appropriate cultureInfo object. This should change the keyboard layout for your WPF application

    InputLanguageManager.Current.CurrentInputLanguage = new CultureInfo("fr-FR");
    

提交回复
热议问题