locked
how to lock the orientation of the Screen in Windows Store using C#

    Question

  • Hi

     How to lock the Orientation of the Screen inside the Application in Windows store using C#

    Friday, August 22, 2014 10:01 AM

Answers

All replies

  • Hai 

       I am Expecting for Windows Store Surface device .In Windows Store Device Supported Orientations is not there here having option for Auto Rotation preferences .I have Done the Same but Facing issue in orientation.Kindly please check my code

               

      private void lockimg_tap(object sender, TappedRoutedEventArgs e)
            {

    Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Landscape;

            }

     private void unlockimg_Tapped(object sender, TappedRoutedEventArgs e)
            {
                
                Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Portrait | Windows.Graphics.Display.DisplayOrientations.Landscape | Windows.Graphics.Display.DisplayOrientations.LandscapeFlipped | Windows.Graphics.Display.DisplayOrientations.PortraitFlipped;
              
            }

    Monday, August 25, 2014 5:30 AM
  • how are you testing this? I think its a known issue that the emulator ignores this property

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Monday, August 25, 2014 5:59 AM
  • I believe this Blog Post here: http://www.kraigbrockschmidt.com/2013/09/05/locking-orientation-supported-rotations-manifest/ explains the whole situation in detail. You can only really test the preferences of the App on a real device which switches the orientation using the Accerlerometer.

    Monday, August 25, 2014 7:49 AM
  • Thanks ...
    Wednesday, August 27, 2014 9:46 AM
  • Thanks its working Now
    Wednesday, August 27, 2014 9:47 AM