Adrian Grigore
Adrian Grigore

Reputation: 33318

How can I disable portrait mode in Windows 8?

I have developed a XAML / C# Windows 8 app which does not support portrait mode. I've opened the Package.appxmanifest in Visual Studio and disabled the the portrait and portrait-flipped mode under "supported rotations". This Created the following rotations preferences:

        <InitialRotationPreference>
          <Rotation Preference="landscape" />
          <Rotation Preference="landscapeFlipped" />
        </InitialRotationPreference>

However, when I start my app in the simulator and rotate the simulator, the app still gets rotated in to portrait mode. how can I prevent this from happening?

Thanks,

Adrian

Upvotes: 9

Views: 9588

Answers (2)

MVarman
MVarman

Reputation: 549

Just in case someone didn't notice the compiler warning, DisplayProperties is obsolete now. The new way of setting AutoRotationPreferences is,

DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;

Upvotes: 2

Paul O.
Paul O.

Reputation: 1176

The simulator in Windows 8 does not seem to respect your rotation preferences. Unfortunately, there is no way to tell if these settings work as expected until connecting to an actual tablet running Windows 8.

Check out this article for some more information, straight from MSDN: http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.display.displayproperties.autorotationpreferences

Upvotes: 7

Related Questions