次の方法で共有


Orientation and SupportedOrientation Properties in Silverlight for WP7

Orientation specifies the orientation in which the page is shown when the app is opened. The values that can be taken by it are “Portrait”, “PortraitUP”, “PortraitDown”, “Portrait”, “LandScapeLeft”, “LandScapeRight”,”LandScape”.

SupportedOrientation specifies the orientations (landscape or portrait or both) that are supported by the app. For example, you rotate your phone – does the app respond to change in orientation? If set SupportedOrientation to “PortraitOrLandscape”, the app would rotate when you change orientation.

Setting Orientation

XAML (This property is set on PhoneApplicationPage)

Orientation="Portrait"

 

Code

this.Orientation = PageOrientation.Portrait;

 

Setting SupportedOrientation

XAML (This property is set on PhoneApplicationPage)

SupportedOrientations="PortraitOrLandscape"

Code

this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;

Comments

  • Anonymous
    September 11, 2010
    Just a note that Orientation is settable only at design-time. The setter has no affect at run-time. Cheers, Daniel