App Orientation

Hello!

I’m having troubles with getting Windows 8 to recognize Landscape mode instead of Portrait mode. Following the steps outlined here - http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html - I set the properties panel to be Landscape. Here’s the relevant code in MainPage.xaml:

Foreground="{StaticResource PhoneForegroundBrush}" Orientation="LandscapeRight"     shell:SystemTray.IsVisible="False" TabIndex="2147483645" SupportedOrientations="Landscape"\>

Is there another setting I should be making for my app to be in Landscape?

Here’s a crappy screenshot of the game on device:

https://drive.google.com/file/d/0Byz-bwuX-tobWUZGb25vTlpQc28/view?usp=sharing

I just tested this out and it worked for me.  Are you sure you are editing the attributes belonging to the <phone:PhoneApplicationPage> tag?

Also, when you are in Visual Studio’s UI designer for your “MainPage.xaml”, the phone displayed in the UI designer should appear landscape too.  That would confirm that the landscape settings that you applied to the XAML took hold.  If your page still appears portrait in the UI designer, then there is something wrong in your XML.

Hello!

In visual studio, the app shows side ways, but it doesn’t show sideways on device. Here’s my MainPage.xml:

\<phone:PhoneApplicationPage &nbsp;&nbsp;&nbsp; xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" &nbsp;&nbsp;&nbsp; xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &nbsp;&nbsp;&nbsp; xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" &nbsp;&nbsp;&nbsp; xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" &nbsp;&nbsp;&nbsp; xmlns:d="http://schemas.microsoft.com/expression/blend/2008" &nbsp;&nbsp;&nbsp; xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" &nbsp;&nbsp;&nbsp; xmlns:corona="clr-namespace:CoronaLabs.Corona.WinRT.Phone;assembly=CoronaLabs.Corona.Controls.DotNet" &nbsp;&nbsp;&nbsp; x:Class="Alphabet\_Jigsaw.MainPage" &nbsp;&nbsp;&nbsp; mc:Ignorable="d" &nbsp;&nbsp;&nbsp; FontFamily="{StaticResource PhoneFontFamilyNormal}" &nbsp;&nbsp;&nbsp; FontSize="{StaticResource PhoneFontSizeNormal}" &nbsp;&nbsp;&nbsp; Foreground="{StaticResource PhoneForegroundBrush}" Orientation="LandscapeRight" &nbsp;&nbsp;&nbsp; shell:SystemTray.IsVisible="False" TabIndex="2147483645" SupportedOrientations="Landscape"\> &nbsp;&nbsp; &nbsp;\<DrawingSurfaceBackgroundGrid x:Name="fDrawingSurfaceBackgroundGrid"\> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\<corona:CoronaPanel x:Name="fCoronaPanel"/\> &nbsp;&nbsp; &nbsp;\</DrawingSurfaceBackgroundGrid\> \</phone:PhoneApplicationPage\>

Also, here is a screenshot of my visual studio. Visual studio is showing my app in landscape mode, but not showing in landscape when testing on device.

https://drive.google.com/file/d/0Byz-bwuX-tobb1QwOTJqT0djZ1U/view?usp=sharing

I don’t see anything wrong in your XML.  What does your “MainPage.xaml.cs” file look like?

Did you code anything in C# that forces the orientation to portrait in your MainPage class’ constructor?

Also, try doing a rebuild of your project by clicking the “BUILD\Rebuild Solution” menu item in Visual Studio.

Other than that, I’m running out of ideas.  Changing those 2 orientation attributes in your xaml should be all that you need to do.

Hello! I’ve resolved the issue! I uninstalled the app completely from my Windows device and reinstalled to get landscape mode to work.

To any future developers reading this post and to summarize, I had issues with my app showing in portrait mode when I set it to landscape. If you’ve tested the app on your device, you may need to completely uninstall the app from your windows phone and then reinstall to see the changes. This worked for me.

Thanks for the assistance Joshua!

Hmm… it sounds like Visual Studio was not overwriting your app when deploying it to the WP8 device.  Good idea about uninstalling the app.  Might be good advice next time someone has a similar issue.  I mean, changing the orientation of your app was supposed to be easy.  :slight_smile:

Off subject: Joshua, while I have you attention, should I be building for ARM or x86 when building for store?

You have to build for “Release|ARM”.

The reason is because all WP8 devices use ARM CPUs.

x86 builds are only for testing your app in the WP8 emulator.

Here’s a crappy screenshot of the game on device:

https://drive.google.com/file/d/0Byz-bwuX-tobWUZGb25vTlpQc28/view?usp=sharing

I just tested this out and it worked for me.  Are you sure you are editing the attributes belonging to the <phone:PhoneApplicationPage> tag?

Also, when you are in Visual Studio’s UI designer for your “MainPage.xaml”, the phone displayed in the UI designer should appear landscape too.  That would confirm that the landscape settings that you applied to the XAML took hold.  If your page still appears portrait in the UI designer, then there is something wrong in your XML.

Hello!

In visual studio, the app shows side ways, but it doesn’t show sideways on device. Here’s my MainPage.xml:

\<phone:PhoneApplicationPage &nbsp;&nbsp;&nbsp; xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" &nbsp;&nbsp;&nbsp; xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &nbsp;&nbsp;&nbsp; xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" &nbsp;&nbsp;&nbsp; xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" &nbsp;&nbsp;&nbsp; xmlns:d="http://schemas.microsoft.com/expression/blend/2008" &nbsp;&nbsp;&nbsp; xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" &nbsp;&nbsp;&nbsp; xmlns:corona="clr-namespace:CoronaLabs.Corona.WinRT.Phone;assembly=CoronaLabs.Corona.Controls.DotNet" &nbsp;&nbsp;&nbsp; x:Class="Alphabet\_Jigsaw.MainPage" &nbsp;&nbsp;&nbsp; mc:Ignorable="d" &nbsp;&nbsp;&nbsp; FontFamily="{StaticResource PhoneFontFamilyNormal}" &nbsp;&nbsp;&nbsp; FontSize="{StaticResource PhoneFontSizeNormal}" &nbsp;&nbsp;&nbsp; Foreground="{StaticResource PhoneForegroundBrush}" Orientation="LandscapeRight" &nbsp;&nbsp;&nbsp; shell:SystemTray.IsVisible="False" TabIndex="2147483645" SupportedOrientations="Landscape"\> &nbsp;&nbsp; &nbsp;\<DrawingSurfaceBackgroundGrid x:Name="fDrawingSurfaceBackgroundGrid"\> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\<corona:CoronaPanel x:Name="fCoronaPanel"/\> &nbsp;&nbsp; &nbsp;\</DrawingSurfaceBackgroundGrid\> \</phone:PhoneApplicationPage\>

Also, here is a screenshot of my visual studio. Visual studio is showing my app in landscape mode, but not showing in landscape when testing on device.

https://drive.google.com/file/d/0Byz-bwuX-tobb1QwOTJqT0djZ1U/view?usp=sharing

I don’t see anything wrong in your XML.  What does your “MainPage.xaml.cs” file look like?

Did you code anything in C# that forces the orientation to portrait in your MainPage class’ constructor?

Also, try doing a rebuild of your project by clicking the “BUILD\Rebuild Solution” menu item in Visual Studio.

Other than that, I’m running out of ideas.  Changing those 2 orientation attributes in your xaml should be all that you need to do.

Hello! I’ve resolved the issue! I uninstalled the app completely from my Windows device and reinstalled to get landscape mode to work.

To any future developers reading this post and to summarize, I had issues with my app showing in portrait mode when I set it to landscape. If you’ve tested the app on your device, you may need to completely uninstall the app from your windows phone and then reinstall to see the changes. This worked for me.

Thanks for the assistance Joshua!

Hmm… it sounds like Visual Studio was not overwriting your app when deploying it to the WP8 device.  Good idea about uninstalling the app.  Might be good advice next time someone has a similar issue.  I mean, changing the orientation of your app was supposed to be easy.  :slight_smile:

Off subject: Joshua, while I have you attention, should I be building for ARM or x86 when building for store?