Orientation and Behaviours in WP7
2/8/2012source: buildmobile.com
As I've pointed out in a number of previous posts, one of the things that sets Windows Phone development apart from other mobile platforms is the awesome set of tools we have to work with. In this post we're going to look at how you can handle the different phone orientations by defining different layouts in Expression Blend.
Let's get started with a new Windows Phone Application. My preference is to create the new project in Visual Studio, and then immediately flip over to Expression Blend. Since we want our page to respond to orientation changes of the device, we need to change the SupportedOrientations property to PortraitOrLandscape. This can be set in the Properties window for the PhoneApplicationPage.
Locate the States window (if it's not visible, you can display it via the Window menu). Initially your page won't have any states or state groups defined, so the first thing to do is to create a new state group by clicking the Add state group icon. We're going to call the state group OrientationStates as it's going to include the different visual states, in other words the different layouts, for the different orientations of the page.
...Read more
You can also follow us on Twitter @winphonegeek
Comments
New! WindowsPhoneGeek Component Marketplace
Our Top Articles & Free books
- Our FREE e-book: "Windows Phone Toolkit In Depth" 2nd edition
- 400+ Windows Phone Development articles in our Article Index
- 21 WP7 Toolkit in Depth articles covering all controls
- 12 WP7 Coding4Fun Toolkit in Depth articles covering all controls
- Performance Tips when creating WP7 apps
- Creating a WP7 Custom Control in 7 Steps
- WP7 working with VisualStates: How to make a ToggleSwitch from CheckBox
- What makes a WP7 App successful
- Creating theme friendly UI in WP7 using OpacityMask
- Implementing Windows Phone 7 DataTemplateSelector and CustomDataTemplateSelector
Our Top Tips & Samples
- All about WP7 Isolated Storage series
- WP7 Dynamically Generating DataTemplate in code
- 5 tips for a successful WP7 Marketplace submission
- WP7: Navigating to a page in different assembly
- WP7 ContextMenu: answers to popular questions
- WP7 ListBox: answers to popular questions
- WP7 working with Images: Content vs Resource build action
- WP7 Element Binding samples
- WP7 working with XML: reading, filtering and databinding
- Drawing in WP7: #2 Drawing shapes with finger
- WP7 TextBox Light theme problems - the solution
- Changing the WP7 Panorama Background Image dynamically with Animation
