Question: I have a WPF application running on a Windows 8.1 tablet. the application is using the following method to show the virtual keyboard:

```
public static void OpenKeyboard()
{
    ProcessStartInfo startInfo =
        new ProcessStartInfo(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe")
        {
            WindowStyle = ProcessWindowStyle.Hidden
        };
    Process.Start(startInfo);
}

```

However, the size of the active window that the keyboard is displayed on top of doesn't change accordingly, meaning that if I have a ScrollViewer surrounding all the elements of my window it doesn't respond to the keyboard.  

Is there any way to make my windows aware of the keyboard presence?  

**Update**  

Tried registering to the `SizeChanged` event of the window but it's not raised when the keyboard pops up.

Answer: 
Since TabTip.exe is a separate process it doesn't fire any events in your WPF application. Since win 8.1 tabtip does not automatically resize windows anymore. (there have been a lot of complaints about it) 

There are a couple of ways you can do this manually. Firstly, Win8 apps have so called "LayoutAware" pages. Something similar can be done in WPF using the VisualStateManager. 
This is rather complex and might not be the best solution, but I included it nevertheless ([VisualStateManager solution here](https://social.msdn.microsoft.com/Forums/vstudio/en-US/192ece42-f17c-4148-b7ad-c5438741c049/a-proper-solution-to-a-wpf-application-using-on-screen-keyboard?forum=wpf)

Another way is to get the tabtip process from the list of active processes and calculate its width and height and use it to manually resize your screens.
Tabtip is if I remember correctly about 270 in height. You can also directly resize your screens as soon as the process appears. Something like this;

```
  public void OpenKeyboard()
         {
             ProcessStartInfo startInfo =
                 new ProcessStartInfo(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe")
                 {
                     WindowStyle = ProcessWindowStyle.Hidden
                 };
             Process.Start(startInfo);

             //this = your window
             this.Height -= 270;

         }

```

There is another more clean way. It is a bit difficult and I haven't tried it myself yet. It is possible to grab the process and resize it where you want. You might be able to do it with the Windows API call 'findWindow()', but as far as I know that doesn't always work with tabtip, you might have to use P/Invoke.
To get you started I found some pretty great sources from which I wont steal credit by copying the code here; [How to resize another application's window in C#](http://csharphelper.com/blog/2016/12/set-another-applications-size-and-position-in-c/)

[Changing another applications size and position using P/invoke (win32)](https://social.msdn.microsoft.com/Forums/windows/en-US/b7dc7c2d-af6d-4f67-9d05-d65f8f22848a/changing-location-and-size-of-another-application-in-c?forum=winforms)

I hope you find this info useful. I know how you feel and have struggled with tabtip myself more often than id like.

*Footnote; isn't it easier to just decrease your max window height and move it to the top of the screen when osk is called and put it back when its killed?*
In another answer I provided from my own research on working with tablets, the following S/O link might help you.

[Tablet App, Auto Rotation and Taskbar Height Adjustments](https://stackoverflow.com/questions/52081836/tablet-app-auto-rotation-and-taskbar-height-adjustments)

I found a variety of things that were not cool, but did come up with some understanding points. Depending on the keyboard, does it actually overlay, or is it part of the anchored taskbar at the bottom of the window with other open tasks. If so, that will inherently change the window available dimensions, almost like a user changing from a lower to higher resolution (or hi/low). This actually changes the view port dimensions for the windows to be displayed. You can hook into

```
SystemEvents.UserPreferenceChanged and 
SystemEvents.DisplaySettingsChanged 

```

to detect and trigger whatever resizing considerations you need. There is also code on forcing your tablet to remain in a single orientation. I needed this because our tablet has a barcode scanner on it and it makes sense to always have the tablet with the scanner NOT pointing to the person, so we have it locked in a specific direction while the app is running.

And lastly, how do you KNOW you have entered (or exited) tablet mode. This shows how to hookup with ManagementEventWatcher to detect when registry entry changes interactively such as rotation, or undocking from a station and becoming free to use in tablet mode.

From your feedback, lets have you try this. From my version of TabTip (Surface Pro tablet), in the top-left is the keyboard settings. From that, if you click on it, it will open a dialog that allow for different keyboard styles from full width, abbreviated, split keyboard and even stylus for writing directly. Below that is an option to have your keyboard docked as the taskbar (left button I circled in red) vs floating window on top of others (I believe yours is running). Try setting your keyboard to a DOCKED state, then check the tablet mode and window environment settings getting changed. Worked for me.

[![enter image description here](https://i.stack.imgur.com/ab5zp.png)](https://i.stack.imgur.com/ab5zp.png)