How to determine orientation of Windows Phone 7?
windows-phone-7
Solution
I myself just have looked at windows 7 phones(through vs2010 express phone edition).
It seems to have in the code behind this
public MainPage()
{
InitializeComponent();
// seems to set the supported orientations that your program will support.
SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
}
Then the actual form has
private void PhoneApplicationPage_OrientationChanging(object sender, OrientationChangedEventArgs e)
{
var test = e.Orientation;
}
So when the orientation changes it e.Orientation will tell you what orientation it is. Like for instance LandscapeRight.
Problem
How can you tell whether the device is oriented vertically (portrait) or horizontally (landscape)? Is there an API that simplifies this or do you have to make the determination "by hand" using the accelerometer?