TouchPanel dimensions reset after orientation change on Win 8.1

Hi to all.

I’m working on my first Monogame app, a W8.1/WP8.1 Universal app. I really like the almost magical way both platforms were supported without me doing anything, apart from the occasional compiler directive to cater for lack of hardware back button on the W8.1 target. I’m using the stable v3.4 version in VS2013 express.

However, I’m facing the following problem:
In the Win8.1 target, when the device is rotated, my TouchPanel.DisplayWidth and TouchPanel.DisplayHeight get reset to the actual screen size. However, I’m using a virtual screen of 1080x1920 so this messes up touch input.

This happens both on the Simulator and a Win8.1 tablet I have. It doesn’t happen on the Win Phone target.

My game is played in portrait mode, therefore I have defined this in the Package.appxmanifest for both targets and in my game1.cs LoadContent code, I set:
graphics.SupportedOrientations = DisplayOrientation.Portrait | DisplayOrientation.PortraitDown

To cater for the difference between the actual screen size and the virtual screen size, as instructed by the Microsoft Virtual Academy Monogame tutorial (, I set:

TouchPanel.DisplayWidth = _drawState.ScreenBounds.Width;
TouchPanel.DisplayHeight = _drawState.ScreenBounds.Height;

(_drawState.ScreenBounds is a 1080x1920 Rectangle).

Since I couldn’t find what was going on, I just decided to subscribe to the size changed event and set the TouchPanel.DisplayWidth and TouchPanel.DisplayHeight variables again. Therefore:

this.Window.AllowUserResizing = true;
this.Window.ClientSizeChanged += Window_ClientSizeChanged;

However, the Window_ClientSizeChanged method is called on the Simulator, but not on the real device.

I tried with:
_window = Windows.UI.Core.CoreWindow.GetForCurrentThread();
_window.SizeChanged += _window_SizeChanged;

Same thing - called on the simulator, not on the device.

After some annoying time staring at the debug screen in disbelief, I decided to change my approach, not use the TouchPanel.DisplayWidth and TouchPanel.DisplayHeight properties, but just translate the touch position to the virtual screen coordinates, by a simple:

float ScreenYScale = GraphicsDevice.PresentationParameters.BackBufferHeight / 1920.0f;

public Vector2 TranslateCoords(Vector2 coords)
    return new Vector2(coords.X / ScreenYScale, coords.Y / ScreenYScale);

This works as intended.