Open Windows 10 touch keyboard docked in WPF

后端 未结 3 661
一整个雨季
一整个雨季 2021-01-01 22:30

We started creating a WPF touch application in Windows 8 and recently migrated to Windows 10. One feature we implemented is opening the Windows Keyboard when a TextBox

3条回答
  •  被撕碎了的回忆
    2021-01-01 22:59

    EDIT: In the case when WindowStyle is set to None, please check out my answer here. Also for manually handling touch keyboard appearance events, check out the sample code here.

    The answers here are quite old, currently the touch keyboard works just fine when tapping any textbox, even if the window is maximized.

    I recommend targeting at least .NET 4.6.2 to get the best support for touch keyboards in Windows 10, due to a bug in WPF that was fixed in that version. Read more here, scroll down to WPF section.

    The only thing you'll have to do is design your XAML in a way that your user interface can react properly when the touch keyboard shows up. Usually putting your content inside a ScrollViewer like so should be enough:

    
    
    

    But for more advanced scenarios, like moving buttons that are at the bottom to above the keyboard, you'll need to write your XAML inside the ScrollViewer more carefully, for example by using grids with dynamic heights.

    Hope this helps!

提交回复
热议问题