Think. Create. Deliver.

Design Process, Inspiration, and User Experience
in

Building the Elusive Windows Phone Panorama Control

1

When the Windows Phone 7 Developer SDK was released a couple of weeks ago at MIX10 many people noticed the SDK doesn’t include a template for a Panorama control.   Here at Clarity we decided to build our own Panorama control for use in some of our prototypes and I figured I would share what we came up with.

There have been a couple of implementations of the Panorama control making their way through the interwebs, but I didn’t think any of them really nailed the experience that is shown in the simulation videos.  

One of the key design principals in the UX Guide for Windows Phone 7 is the use of motion.  The WP7 OS is fairly stripped of extraneous design elements and makes heavy use of typography and motion to give users the necessary visual cues.  Subtle animations and wide layouts help give the user a sense of fluidity and consistency across the phone experience.  When building the panorama control I was fairly meticulous in recreating the motion as shown in the videos. 

The effect that is shown in the application hubs of the phone is known as a Parallax Scrolling effect.  This this pseudo-3D technique has been around in the computer graphics world for quite some time. In essence, the background images move slower than foreground images, creating an illusion of depth in 2D.  Here is an example of the traditional use: http://www.mauriciostudio.com/

One of the “animation gems” I've learned while building interactive software is the “follow animation”.  The premise is straightforward: instead of translating content 1:1 with the interaction point, let the content “catch up” to the mouse or finger.  The difference is subtle, but the impact on the smoothness of the interaction is huge.  That said, it became the foundation of how I achieved the effect shown below. 

 Source Code Available HERE

Before I briefly describe the approach I took in creating this control..and I’ll add some **asterisks ** to the code below as my coding skills aren’t up to snuff with the rest of my colleagues.  This code is meant to be an interpretation of the WP7 panorama control and is not intended to be used in a production application. 

1.  Layout the XAML

The UI consists of three main components :  The background image, the Title, and the Content.  You can imagine each  these UI Elements existing on their own plane with a corresponding Translate Transform to create the Parallax effect. 

xaml

2.  Storyboards + Procedural Animations = Sexy

As I mentioned above, creating a fluid experience was at the top of my priorities while building this control.  To recreate the smooth scroll effect shown in the video we need to add some place holder storyboards that we can manipulate in code to simulate the inertia and snapping.  Using the easing functions built into Silverlight helps create a very pleasant interaction. 

 xaml2

3.  Handle the Manipulation Events

With Silverlight 3 we have some new touch event handlers.  The new Manipulation events makes handling the interactivity pretty straight forward.  There are two event handlers that need to be hooked up to enable the dragging and motion effects:

the ManipulationDelta event :  (the most relevant code is highlighted in pink)

code1

Here we are doing some simple math with the Manipulation Deltas and setting the TO values of the animations appropriately. Modifying the storyboards dynamically in code helps to create a natural feel….something that can’t easily be done with storyboards alone.

 

And secondly, the ManipulationCompleted event: 

code2

Here we take the Final Velocities from the Manipulation Completed Event and apply them to the Storyboards to create the snapping and scrolling effects.  Most of this code is determining what the next position of the viewport will be.  The interesting part (shown in pink) is determining the duration of the animation based on the calculated velocity of the flick gesture.  By using velocity as a variable in determining the duration of the animation we can produce a slow animation for a soft flick and a fast animation for a strong flick.

Challenges to the Reader

There are a couple of things I didn’t have time to implement into this control.  And I would love to see other WPF/Silverlight approaches. 

1.  A good mechanism for deciphering when the user is manipulating the content within the panorama control and the panorama itself.   In other words, being able to accurately determine what is a flick and what is click.

2.  Dynamically Sizing the panorama control based on the width of its content.  Right now each control panel is 400px, ideally the Panel items would be measured and then panorama control would update its size accordingly. 

3.  Background and content wrapping.  The WP7 UX guidelines specify that the content and background should wrap at the end of the list.  In my code I restrict the drag at the ends of the list (like the iPhone).  It would be interesting to see how this would effect the scroll experience.  

 

Well, Its been fun building this control and if you use it I’d love to know what you think.  You can download the Source HERE or from the Expression Gallery

 Erik Klimczak  | eklimczak@claritycon.com | twitter.com/eklimcz

Comments

Twitter Trackbacks for Building the Elusive Windows Phone Panorama Control - Think. Create. Deliver. [claritycon.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Building the Elusive Windows Phone Panorama Control - Think. Create. Deliver.         [claritycon.com]        on Topsy.com

# March 30, 2010 6:20 PM

on Windows Phone 7 said:

Anyone doing development work for Windows Phone 7 will notice a few missing tools, especially when your

# March 30, 2010 9:34 PM

Guide to Snowboarding | Snowboarding Boards | Skiing Leisure Knowledge said:

Pingback from  Guide to Snowboarding | Snowboarding Boards | Skiing Leisure Knowledge

# March 31, 2010 1:21 AM

uberVU - social comments said:

This post was mentioned on Twitter by LKWave: Building the Elusive Windows Phone Panorama Control - Think ... http://bit.ly/9RCi9k #SL #RIA

# March 31, 2010 12:20 PM

progg.ru said:

Thank you for submitting this cool story - Trackback from progg.ru

# March 31, 2010 9:47 PM

Rob Relyea - XAMLified said:

Filling a temporary (?) gap, Clarity Consulting posted a Windows Phone 7 Panorama Control in “ Building

# April 1, 2010 9:35 AM

Think. Create. Deliver. said:

Designing applications for the Win Phone 7 is very similar to designing for print. In my opinion, it

# April 1, 2010 11:04 AM

on Windows Phone 7 said:

Designing applications for the Win Phone 7 is very similar to designing for print. In my opinion, it

# April 1, 2010 11:59 AM

Alberto Silva said:

XNA or Silverlight for Windows Phone 7 game development? blogs.silverarcade.com/silverlight-games

# April 6, 2010 6:41 PM

Silverlight and Windows Phone 7 Link Post » Gary Pretty’s Blog said:

Pingback from  Silverlight and Windows Phone 7 Link Post »  Gary Pretty’s Blog

# April 8, 2010 7:36 PM

.NET Addicted said:

Windows Phone 7 : Pivot Control

# April 11, 2010 7:49 PM

Lista de recursos para desarrolladores de Windows Phone 7 - Windows Phone 7 Puerto Rico said:

Pingback from  Lista de recursos para desarrolladores de Windows Phone 7 - Windows Phone 7 Puerto Rico

# April 25, 2010 9:11 PM

Windows Phone 7 Hubs erstellen? - Programmieren - Windows Mobile Forum said:

Pingback from  Windows Phone 7 Hubs erstellen?              -                               Programmieren - Windows Mobile Forum

# May 2, 2010 11:30 PM

Windows Phone Tutorials - Windows Phone Entwicklung - Windows Mobile Forum said:

Pingback from  Windows Phone Tutorials              -                               Windows Phone Entwicklung - Windows Mobile Forum

# May 3, 2010 11:40 AM

Unlocked Windows Phone 7 image shows Office, progress | The Internet Database said:

Pingback from  Unlocked Windows Phone 7 image shows Office, progress | The Internet Database

# May 4, 2010 5:51 AM

BIEB - News Source Blog said:

The Windows Phone 7 developer kit was updated last week . The new version brought support for the RTM

# May 4, 2010 5:53 AM

Unlocked Windows Phone 7 image shows Office, progress | UpOff.com said:

Pingback from  Unlocked Windows Phone 7 image shows Office, progress | UpOff.com

# May 4, 2010 5:55 AM

Unlocked Windows Phone 7 image shows Office, progress said:

Pingback from  Unlocked Windows Phone 7 image shows Office, progress

# May 4, 2010 6:26 AM

Unlocked Windows Phone 7 image shows Office, progress « Digital Asylum said:

Pingback from  Unlocked Windows Phone 7 image shows Office, progress «  Digital Asylum

# May 4, 2010 8:01 AM

delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. said:

Pingback from  delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more.

# May 4, 2010 9:46 AM

delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. said:

Pingback from  delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more.

# May 4, 2010 9:48 AM

Unlocked Windows Phone 7 image shows Office, progress | BestGadget.Info said:

Pingback from  Unlocked Windows Phone 7 image shows Office, progress | BestGadget.Info

# May 4, 2010 10:44 PM

Microsoft News » Unlocked Windows Phone 7 image shows Office, progress said:

Pingback from  Microsoft News » Unlocked Windows Phone 7 image shows Office, progress

# May 6, 2010 1:13 PM

بررسی ویندوز فون 7 | مجله اينترنتي گوياآي‌تي said:

Pingback from  بررسی ویندوز فون 7 | مجله اينترنتي گوياآي‌تي

# May 16, 2010 11:30 PM

عصر ایرانی | جدید ترین و بروزترین اخبار جهان | معرفی جدید ترین تکنولوژی روز دنیا | اخبار ساسی و … |با ما همراه باشید - بررسی ویندوز فون ۷ said:

Pingback from  عصر ایرانی | جدید ترین و بروزترین اخبار جهان | معرفی جدید ترین تکنولوژی روز دنیا | اخبار ساسی و … |با ما همراه باشید -   بررسی ویندوز فون ۷

# May 17, 2010 1:22 AM

fignewtron was here said:

Notes from WP7 Tips and Tricks PDX Code Camp Talk

# May 24, 2010 9:29 PM

Links to sample code for the Windows Phone 7 « Bruce Barrera said:

Pingback from  Links to sample code for the Windows Phone 7 «  Bruce Barrera

# June 11, 2010 3:37 PM

on Windows Phone 7 said:

If you have been tinkering around with the Windows Phone 7 SDK you’ve probably noticed a handful of controls

# June 24, 2010 2:52 PM

Think. Create. Deliver. said:

If you have been tinkering around with the Windows Phone 7 SDK you’ve probably noticed a handful of controls

# June 24, 2010 2:53 PM

C#: Panorama Control f??r Windows Phone 7 ?? bauer-martin.com said:

Pingback from  C#: Panorama Control f??r Windows Phone 7 ?? bauer-martin.com

# July 13, 2010 10:51 PM

Don's Mobile Design Blog said:

Windows Phone 7 Panorama Controls

# August 16, 2010 7:27 PM