Philippe Maes
Philippe Maes

Reputation: 510

Detecting orientation change when only supporting portrait

I want to navigate to a page when the user holds the phone in landscape mode without changing the orientation of the first page (which only supports portrait). Is this possible in Windows Phone?

OrientationChanged="OrientationChanged"
SupportedOrientations="Portrait" Orientation="Portrait"

The "OrientationChanged" event does not get called.

Upvotes: 1

Views: 397

Answers (1)

Alex Sorokoletov
Alex Sorokoletov

Reputation: 3101

The event is not getting fired because you set SupportedOrientations to Portrait only. For your scenario you can set SupportedOrientations to PortraitOrLandscape and then in the event handler OrientationChanged you can see what is current orientation and navigate to page.

It seems to me that the goal you are trying to achieve can be achieved easier without navigating to other page. For example, there is an old article on how to deal with orientation changes: http://blogs.msdn.com/b/ptorr/archive/2010/03/27/strategies-for-dealing-with-orientation-changes.aspx

Upvotes: 2

Related Questions