During the development of window phone, you can set the rotation of horizontal and vertical screens in the header of the XAML file.
Supportedorientations = "portraitorlandscape" orientation = "portrait"
Note: supportedorientations is the horizontal and vertical screen mode of the page, which is divided into three types: portraitorlandscape (landscape screen), portrait (landscape screen), and landscape (landscape screen)
Orientation is the page display mode at startup.
If you make various judgments, delegate the method in the page constructor of the CS file in the background, and then judge and complete the function in the implementation method. For example, when I perform the paging function, the default 10 data records are loaded on the portrait screen, and 5 data records are loaded on the Landscape screen by default.
public CustomerPage() { InitializeComponent(); OrientationChanged += new EventHandler<OrientationChangedEventArgs>(CustomerPage_OrientationChanged); } void CustomerPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { if (e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight) { PageCount = 5; } else if (e.Orientation == PageOrientation.PortraitDown || e.Orientation == PageOrientation.PortraitUp) { PageCount = 10; } }