[SOLVED] How do change screen orientation in windows 10 uwp?

  • Hi all!

    I can't change screen orientation from portrait to landscape and backward in my windows 10 mobile app, when i touch button and go to layout. Browser object not work.

    How i can can do this?

  • I solved this problem! If you want that your windows 10 universal app toggle from portrait to landscape orientation:

    • In construct 2 for lock app in portrait orientation:

    On start of layout -> Execute javascript: "Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.portrait;"

    • For toggle to landscape orientation:

    On start of layout or On touched object -> Execute javascript: "Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.landscape;"

    • In visual studio 2015 open package.appxmanifest your app and set in Aplications tab supported rotations - landscape and portraite.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi. Thanks for the update. But how did you try it before when it did not work?

    I just made a test project and used this:

    It works fine on preview and on mobile browser but I could not test it in Visual Studio yet cause I have no WinPhone to test it or WinTablet. So my example will not work?

  • Hi. Thanks for the update. But how did you try it before when it did not work?

    I just made a test project and used this:

    It works fine on preview and on mobile browser but I could not test it in Visual Studio yet cause I have no WinPhone to test it or WinTablet. So my example will not work?

    THANK YOU!!!! canvas size!!!!!!! its workt!!!!!!!!!!!!!!!!!!!!!!

    change screen orientation landscape portrait its realy worcked!!! thank you so much!!

    You need only change canvas size!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)