Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine the current orientation

I would like to determine the current orientation of the device in a WP7 app. I do not want to handle the OrientationChange event, because I need the current orientation when the page is opened.

I've been trying to do it with this piece of code I found in a forum:

((PhoneApplicationFrame)Application.Current.RootVisual).Orientation

However, this always returns with PortraitUp, even if I turn the device sideways. And by the way, I am trying to do this with the emulator, so it might be an emulator-bug.

Thanks

like image 651
Mark Vincze Avatar asked Jul 21 '26 00:07

Mark Vincze


1 Answers

Just tested it on the emulator and on my device. In the emulator it's like Mark is metioning it's always returning PotraitUp.

However if i test it on my device than the correct orientation is directly returned. So probably as Mark is suggesting it's a emulator bug.

like image 100
ChristiaanV Avatar answered Jul 26 '26 00:07

ChristiaanV



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!