Windows Phone 7 for vertical and horizontal display of the screen

Source: Internet
Author: User

In Windows Phone 7, there are two screen directions: Portrait and landscape. in XAML, there are two attributes to set the display direction of the screen, and the screen display direction at startup:

The supportedorientations attribute sets the display direction that can be supported by the screen. Generally, it is set to one of the following three values:

Portrait: only portrait screen is supported. Landscape: only horizontal screen is supported.

Portraitorlandscape: indicates that the screen can be switched between the portrait screen and the horizontal screen.

The orientation attribute sets the display direction when the screen is started: Generally, it sets portrait or landscape ).

For example:

Supportedorientations = "portraitorlandscape" orientation = "portrait"

That is, you can set this page to support both landscape and landscape screens. When the page is started, it is started with landscape screens.

At the same time, we can also set the screen direction in the C # code, for example:

 Supportedorientations = Supportedpageorientation. portraitorlandscape;

That is, you can set the orientation of the screen to support both landscape and landscape screens.

In addition, the horizontal direction can be divided into landscaperight and landscapeleft, indicating that the mobile phone buttons at the horizontal start are left or right. Likewise, the vertical direction can be divided into two situations: portraitup and portraitdown.

If we want to perform some operations or some functions that we have added when switching the screen direction (such as hiding a control or displaying some information ), we can rewrite the page's orientationchanged event, for example:

OrientationChanged + = newEventHandler <OrientationChangedEventArgs> (OnePicture_OrientationChanged);
    void OnePicture_OrientationChanged (objectsender, OrientationChangedEventArgse)
             {
// Add your own rewrite generation
} 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.