Step 3 of 3: Customizing the Application

Now you're ready to run the application. Complete the following steps:

1.   From the Debug menu, select Start Debugging. Your application will open in the Windows Phone emulator and will appear similar to the following:

 

 

2.   Click the Rotate Right or Rotate Left button in the menu to view how the application would appear in landscape mode. Notice that the application does not rotate. In the next step you'll customize the application so that it rotates when the phone is turned.

3.   Click the Stop Debugging button to close the application.

4.   Edit the <phone:PhoneApplicationPage> tag to set the SupportedOrientations property to PortraitOrLandscape. It will appear similar to the following:

      XAML Markup

By default when the phone is rotated, the application's interface does not rotate. By setting the SupportedOrientations property to PortraitOrLandscape the application will now rotate when the phone is rotated. In the next step you'll customize the appearance of the application when the phone is rotated to landscape mode.

5.   In XAML view, click once on the <phone:PhoneApplicationPage> tag to select it, navigate to the Properties window, and select the Event tab to view the available events.

6.   In the Properties window, locate and double-click the space next to the OrientationChanged event. This will create the OrientationChanged event handler and switch to Code view.

7.   Add code to the OrientationChanged event handler so it appears similar to the following:

      Visual Basic

      C#

The Orientation property determines if items in the panel are displayed horizontally or vertically. By default Orientation is set to Vertical and the panel displays content vertically; setting Orientation property to Horizontal will display content horizontally. In the above code, the Orientation property is set in the OrientationChanged event handler so that when the phone is in portrait mode the C1WrapPanel content will be displayed vertically and when the phone is in landscape mode the content will be displayed horizontally

8.   Click Start Debugging again in the Debug menu. When the application is displayed in landscape mode it will now appear like the following:

 

 

Congratulations! You have successfully completed the WrapPanel for Windows Phone quick start.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.