Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Phone

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

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
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
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server