[UWP] Windows 11 Touch Keyboard pushes up content and create blank space

Md. Niaz Mahmud 111 Reputation points

I am developing an uwp app, in windows 11, when touch keyboard shows up, the contents is pushed up and there creates blank space between my page content and touch keyboard. and when this issue happens, the page becomes draggable into that blank space and can be moved. This issue happens sometimes, not always. And this issue doesn't happen in windows 10. The code snippet is as follows:

private void InputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args)  
      args.EnsuredFocusedElementInView = true;  
           var parent = Page.Parent as FrameworkElement;  
           Page.Height = parent.ActualHeight - inputPane.OccludedRect.Height;  
           Page.VerticalAlignment = VerticalAlignment.Top;  
Universal Windows Platform (UWP)
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,383 questions
{count} vote