Height of Windows in WPF Application when Touch Keyboard appears Height of Windows in WPF Application when Touch Keyboard appears wpf wpf

Height of Windows in WPF Application when Touch Keyboard appears


From what I remember, if you've written your XAML right, it should work out of the box even when the window is maximized, but I also ran into trouble with this and ended up not fixing it (I would have wanted to, but higher management decided not to care about it).

From my investigations it seems like Microsoft fixed how Windows reacts to the presence of the touch keyoard in Windows 1903, while in 1809 and older versions, Windows does not resize the window. You can test this by maximizing Explorer and see what happens in both versions of Windows 10.

Also if your app has set WindowStyle to None, it prevents Windows from resizing your window to keep the controls visible. I talked about this in my answer here: WindowStyle None and touch input.

Also it's possible to manually reposition your controls by detecting the presence and position of the touch keyboard, check out this sample from Microsoft: TouchKeyboardNotifier

If all else fails, I think the TouchKeyboardNotifier sample code should help you achieve what you need without relying on Windows behavior.


have you tried use when creating the windows:

    this.SizeToContent = SizeToContent.WidthAndHeight;

This will fix automatically the width and the height to fit the current size.

Source:https://docs.microsoft.com/en-us/dotnet/framework/wpf/app-development/how-to-automatically-size-a-window-to-fit-its-content