开发者

How to handle the orientation in windows phone 7?

I have created three pages:- page 1 main ,page 2 portrait and page 3 landscape . I have to tak开发者_JAVA百科e two separate pages for different orientation because my GUI components layout are totally different in both modes. Support Orientation for main is PortraitOrLandscape ,similarly for page 2 is portrait and for page 3 is landscape. Now according to the orientation of main page the orientation of next page to be open is called.

Ex: Main page is in landscape mode then the next page which will open is page 3 landscape. Now i want if the user switches to portrait mode then the page 2 portrait will open. I can switch to page 3 or page 2 from main page but how can i switch from page 2 to page 3 vice verse.


Using separate pages for different orientations is a really bad idea and can only result in a significantly slower user experience for your users.

A much better way to handle this is to use VisualStateManager to switch between different layouts when the orientation changes. If your UI is so significantly different, then you can always create two different user controls and toggle their visibility on state change.

András Velvárt has a great post that covers this topic and includes a behavior you can use, too.


You could handle the OrientationChanged event and navigate there to whatever page is appropriate. Take care though that you stick to the rules for the Back button or your application will not be accepted to the store.

A better way might be to design completely different page styles for the different orientations of the phone. That way you can stick to rules for the store.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜