Logo
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Phone

Windows Phone 8 : Developing for the Phone - The Phone Experience (part 1) - Orientation

6/16/2013 5:18:13 PM

Phones are different. Yes, but it deserves to be reiterated. Phones are different. The development experience is different, too. While developing your application, you will have to deal with several facilities that relate to the user’s experience on the phone: phone orientation, touch input, phone-specific controls, the application bar. In this section you will learn how to deal with these different areas of functionality.

1. Orientation

The phone supports three main orientations: portrait, landscape left, and landscape right, as shown in Figures 1, 2, and 3. These orientations are supported on all the phones. You can control which orientation(s) your application supports as well as switching between them.

Image

FIGURE 1 Portrait orientation

Image

FIGURE 2 Landscape left orientation

Image

FIGURE 3 Landscape right orientation

On the PhoneApplicationPage class, you can specify which orientations you expect your application to support:

<phone:PhoneApplicationPage
                ...
                SupportedOrientations="PortraitOrLandscape">

The SupportedOrientations accepts one of the values in the SupportedPageOrientation enumeration: Landscape, Portrait, or PortraitOrLandscape. By specifying PortraitOrLandscape, you are telling the phone that you want to enable the orientation to change as the phone is turned. By default, the phone will simply attempt to display your page using the new orientation. Because the default project template creates a page that is essentially just a grid within a grid, often this works. But in many cases you will want to customize the experience when the user changes the orientation. The PhoneApplicationPage class supports an OrientationChanged event that is fired when the orientation changes, and this is a common way to change the user interface:

public partial class MainPage : PhoneApplicationPage
{
  // ...

  // Constructor
  public MainPage()
  {
    InitializeComponent();

    // Change size of app based on changed orientation
    OrientationChanged += MainPage_OrientationChanged;
  }
}

This will give you a chance to change your application as necessary. For example, if you just wanted to resize some of your user interface, you could scale the application depending on the orientation:

void MainPage_OrientationChanged(object sender,
                                 OrientationChangedEventArgs e)
{
  if ((e.Orientation & PageOrientation.Landscape) ==
                              PageOrientation.Landscape)
  {
    theScaler.ScaleX = theScaler.ScaleY = .86;
  }
  else if ((e.Orientation & PageOrientation.Portrait) ==
                              PageOrientation.Portrait)
  {
    theScaler.ScaleX = theScaler.ScaleY = 1.16;
  }
}

Although using a rendering transformation will help you change your user interface, you might decide to rearrange your design dramatically for the change in orientation, or even use a different view. The amount of change is completely up to you.


Other -----------------
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 3) - Tombstoning
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 2) - Navigation
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 1)
- Windows Phone 8 : Designing for the Phone - Implementing the Look and Feel of the Phone
- Windows Phone 8 : Designing for the Phone - Designing with Visual Studio
- Windows Phone 7 : 3D Game Development (part 4) - Rendering 3D Models
- Windows Phone 7 : 3D Game Development (part 3) - The Game Class
- Windows Phone 7 : 3D Game Development (part 2) - Rendering 3D Primitives
- Windows Phone 7 : 3D Game Development (part 1) - 3D Game Concepts
- Windows Phone 8 : Phone-Specific Design (part 3) - Using the Pivot Control in Blend
- Windows Phone 8 : Phone-Specific Design (part 2) - Using the Panorama Control in Blend
- Windows Phone 8 : Phone-Specific Design (part 1) - The ApplicationBar in Blend
- Windows Phone 7 : AlienShooter Enhancements (part 2) - Tombstone Support, Particle System
- Windows Phone 7 : AlienShooter Enhancements (part 1) - Load and Save Game State
- Windows Phone 7 Programming Model : Application Execution Model
- Windows Phone 7 Programming Model : Bing Maps Control
- Windows Phone 8 : Designing for the Phone - Blend Basics (part 4) - Working with Behaviors
- Windows Phone 8 : Designing for the Phone - Blend Basics (part 3) - Creating Animations
- Windows Phone 8 : Designing for the Phone - Blend Basics (part 2) - Brushes
- Windows Phone 8 : Designing for the Phone - Blend Basics (part 1) - Layout
 
 
Most view of day
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 7)
- Windows Phone 7 : 3D Game Development (part 1) - 3D Game Concepts
- Managing Windows 7 : Configuring a Pen or Touch Computer, Managing Pen Settings
- Adobe Dreamweaver CS5 : Using Library Items and Server-side Includes (part 2) - Using the Library Assets Panel - Inserting a Library item in your Web page
- Windows Server 2012 Group Policies and Policy Management : Understanding Group Policy (part 2) - Group Policy Link Enforcement, Group Policy Inheritance, Group Policy Block Inheritance
- System Center Configuration Manager 2007 : Creating and Modifying Configurations (part 5) - External Authoring, Authoring with CP Studio
- Microsoft Exchange Server 2010 : Managing Transport and Journaling Rules - Setting Up Message Classifications (part 2)
- Adobe Flash Catalyst CS5 : Applying and removing filters
- Microsoft PowerPoint 2010 : Animating Slide Content (part 1) - Choosing an Animation Effect
- Microsoft Exchange Server 2010 : Defining Email Addresses (part 3) - Email Address Policies - Creating a New Email Address Policy
Top 10
- Integrating SharePoint 2013 with the Office Applications (part 10) - Microsoft Outlook - Lists and Libraries
- Integrating SharePoint 2013 with the Office Applications (part 9) - Microsoft InfoPath - Customizing the Document Information Panel and List Forms
- Integrating SharePoint 2013 with the Office Applications (part 8) - Microsoft InfoPath -Deploying a Form Via Central Administration, Rendering a Form Using the InfoPath Form Web Part
- Integrating SharePoint 2013 with the Office Applications (part 7) - Microsoft Access - Access Services
- Integrating SharePoint 2013 with the Office Applications (part 6) - Microsoft Access
- Integrating SharePoint 2013 with the Office Applications (part 5) - Microsoft OneNote
- Integrating SharePoint 2013 with the Office Applications (part 3) - Microsoft Excel
- Integrating SharePoint 2013 with the Office Applications (part 3) - Microsoft Excel
- Integrating SharePoint 2013 with the Office Applications (part 2) - Microsoft Word - Compare Document Versions, Quick Parts
- Integrating SharePoint 2013 with the Office Applications (part 1) - Microsoft Word - Writing Blog Posts
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro