Tuesday, 6 May 2014

Creating your own Windows Phone UI Controls using Microsoft Expression Blend

This tutorial provides a step-by-step guide to creating custom UI controls using Expression Blend, using the example of a simple on-off switch.

Introduction

Aren’t there times where you need to add a Control in your Form or Page while in designer mode? Yes, the first place to look is your Toolbox. But what if there isn’t a Control that fits exactly to your needs? At those times you were relying on your code. Drawing on Canvas on some platforms or extending other Controls and overriding onPaint methods on other. A time consuming process including many application runs and debugging until achieving a satisfying result. Not to mention the effort needed to animate the Control.
In our case, Windows Phone, you will be surprised how few Controls are at your disposal. Controls that are often used or found in other applications that came preinstalled with the phone are not in your Toolbox (like the on/off switch of the Settings application). This article’s title could more accurately be “Breaking the ice between the developer and Expression Blend”. That’s because, in this article, I’ll try to vanquish the fear of someone else (even a tool) editing your code and the belief that everything is best done when done in code. Expression Blend is a very powerful tool and easy to use in order to quickly achieve very common but also time consuming jobs.
For this article you will need Visual Studio 2010 and Microsoft Expression Blend. We will create a custom Control to use as an on/off switch. So, let’s get started.

Getting started

Let us first create a Windows Phone project.
Start Visual Studio then go to File -> New -> Project…
Then select Visual C# -> Silverlight for Windows Phone -> Windows Phone Application
At the bottom give the Name SwitchProject to your project.
If you have both Windows Phone SDK 7.0 and 7.1 installed you will be prompted to select one. Select Windows Phone OS 7.0 as we won’t need something that came with the 7.1 SDK.
Select platform.png
Now you should be able to see the initial project that the Visual Studio has created. Just for verification, you can see that the toolbox doesn’t have the Switch control that you so desperately need! No worries, we will create one ourselves.
Right click your project’s name on the Solution Explorer and select Add -> New Item…
Then, from the screen that shows up, select Visual C# -> Silverlight for Windows Phone -> Windows Phone User Control.
Let’s call it MySwitch.xaml.
The Solution Explorer as it is after adding our new Windows Phone User Control


As you can see, two new files have been added in your solution. The MySwitch.xaml and the code-behind file MySwitch.xaml.cs. On the XAML editing panel you should see the code below and a big 480x480 square in the designing panel waiting for us to draw on it.
<UserControl x:Class="SwitchProject.MySwitch"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
 
    <Grid x:Name="LayoutRoot">
    </Grid>
</UserControl>


First steps in Expression Blend

Now start Expression Blend. Click File -> Open Project/Solution… and select our SwitchProject.csproj from the disk.
Wait… what? What a design tool has to do with our C# project? Well, Expression Blend is a tool for designing XAML interfaces for applications built with Silverlight and WPF. Silverlight and XAML is our case so it’s completely normal for Expression Blend to be able to open it!
So, after opening the project you will notice our project appearing in the Solution Explorer just like we left it back in Visual Studio.
Double click the MySwitch.xaml file.
In the center of the screen, the designing panel, you can see the empty 480x480 rectangle that we saw in Visual Studio. On the left you can see a tab with the name Objects and Timeline. In this tab we can see the hierarchy of controls and shapes used in our Control. It is the tab that we will use for the rest of the article. For now, our control consists of only a Grid named LayoutRoot as we would expect from the xaml code above. The root node in the hierarchy tree represents our control as a whole and it is named [UserControl]. Click it.
The Solution Explorer and the Objects and Timeline tab as they appear in Expression Blend
We don’t want our switch to be that big so we will change its size. To do so we could just drag the edges in the designing panel or we can use the Layout area that appears at the right of the screen under ther Properties tab. Let’s just edit the width and height from there and set it to Width=160 and Height=80 (that’s big enough for presentation reasons).
The Layout area of properties
Now that we are satisfied with our Control’s size let’s start drawing in it. On the far left of the screen click the Rectangle button (or press M on your keyboard). Our mouse cursor will be transformed into a cross. Drag the mouse and create a rectangle like shown below. A rectangle was added in our hierarchy. Click it so that we can change some of its properties.
After adding the rectangle After changing the rectangle's properties (BorderRect)
On the Brushes area on the right, click on Fill and select No Brush and then click on Stroke and select the white color (#FFFFFFFF).
On the Appearance area set the StrokeThickness property to 4.
That’s all we had to do to create a border for our switch. Give it the name BorderRect setting the Name property in the Properties tab.
Now let’s add a bit of color so that we know when our switch is on or off. We will add another rectangle for that. From the Layout area set the rectangle’s Width, Height and Margin properties to make it exactly fit into BorderRect. Also on the Brushes area, click on Fill and set it to red (#FFFF0000) and then click on Stroke and select No Brush. Finally set the StrokeThickness property to 0. Let’s name it FillRect.
Adding the FillRect
One more rectancle and our switch is done. The last rectangle will represent the actual switch. So place it at the right and allow its size to exceed the BorderRect. I set it to Width=40 and Height=80. Set white (#FFFFFFFF) for Fill, No Brush for Stroke and set StrokeThickness to 0. Finally let’s name it SwitchRect.
Adding the SwitchRect
Save our work! The drawing is done and our hierarchy should look like below.
The control's hierarchy


Turning on and off the switch with animation

The drawing is done but we need to give our switch some life by animating its on and off functions. We’ll do this with StoryBoards.
Objects and Timeline tab The New StoryBoard dialog
Click on the plus sign at the top right of the Objects and Timeline tab. A window will appear asking us to give the new StoryBoard a name. Type TurnOffStoryBoard. Now our Objects and Timeline tab should look like the above. On the right side is where we will set the states that the rectangles we drew before will have.
To turn off the switch we need to turn our FillRect to transparent and place our SwitchRect to the left. So follow these steps:
  1. Click the FillRect.
  2. Set the Timeline at time 0 and click the Record Keyframe button.
  3. On the Appearance area at the properties ensure the Opacity property is set at 100%.
  4. Now set the Timeline at 1. That would be the duration of our storyboard. It’s a bit slow for a switch to take one second to turn off but it’s fine for our tutorial.
  5. Click the Record Keyframe button again to set the state of our FillRect at that moment. Now change the Opacity property to 0%.
  6. Now we will define how the transition from one Keyframe to the other will happen. To do so click somewhere in the shapes representing the Keyframes and in its Properties tabs choose an easing function to use. Use the play button of the StoryBoard to actually see the animation we created. I think the Cubic out is fine.
    Selecting an easing function for the animation
  7. Time to animate the SwitchRect now. So click it, set the Timeline back to 0 and click the Record Keyframe button. Our SwitchRect is in position so let’s move on.
  8. Set the Timeline to 1 and press the Record Keyframe one last time.
  9. Now we need to send the SwitchRect to the left side of the control. We won’t do that by changing its position or margin or size as these properties cannot be changed in a StoryBoard. We will use the Transform area of the properties. So, select the Translate tab and set the property X=-120 (move back 120 pixels) and leave Y=0.
  10. Finally, select the same easing curve for this animation.
  11. You can now click the play button to see the animation in its full glory!
Now, to turn on the switch we need another StoryBoard named TurnOnStoryboard. The process of creating it is similar to the TurOffStoryboard and is left as an exercise to the reader. If you find it dificult you can always download the project's source code and play with it in Expression Blend.

So far so good. We drew our switch and we made it move. Now save everything and let’s go back to Visual Studio to use it on our application!

Using our control in code

When switching back to Visual Studio you will probably see a message informing you that someone has edited your MySwitch.xaml file without using the Visual Studio. That’s right, Expression Blend did. Click “Yes” to reload it.


Reload MySwitch.xaml to show up the changes we did in Expression Blend
As you can see a new element in our xaml has been added named UserControl.Resources and our LayoutRoot Grid now contains our three rectangles. Finally you can see the shape of our switch on the designer panel.
Now we need our control to handle the user interaction. For that reason we will add an event listener to our Grid to get user touches. We will register to the Grid’s MouseLeftButtonDown event and our Grid should look like below in xaml.

<Grid x:Name="LayoutRoot"
          MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown" >
     <Rectangle x:Name="BorderRect" Margin="8" Stroke="White" StrokeThickness="4"/>
     <Rectangle x:Name="FillRect" Margin="12" StrokeThickness="0" Fill="Red"/>
     <Rectangle x:Name="SwitchRect" Fill="White" HorizontalAlignment="Right" StrokeThickness="0" Width="40" Height="80" RenderTransformOrigin="0.5,0.5">
      <Rectangle.RenderTransform>
       <CompositeTransform/>
      </Rectangle.RenderTransform>
     </Rectangle>
</Grid>
 
A function named LayoutRoot_MouseLeftButtonDown was created in our code-behind MySwitch.xaml.cs file if we added the event listener from the xaml, looking like the following
private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
 
}
Or else you can paste that function to your code and add the below line of code in your MySwitch constructor under the InitializeComponent() call.
LayoutRoot.MouseLeftButtonDown+=new MouseButtonEventHandler(LayoutRoot_MouseLeftButtonDown);
We also need to create a boolean property for our control in order to hold its state. Let’s call it SwitchIsON, initialize it to true in our constructor and set its body to the following:
public bool SwitchIsON
{
     get;
     private set;
}
We finally need to change this property every time the user touches our switch and use the StoryBoards we created in Expression Blend to animate the appropriate action. Also we need to fire an event so that others know when our control's state is changed. So our code should look like the following:
public partial class MySwitch : UserControl
{
    public bool SwitchIsON
    {
        get;
        private set;
    }
 
    public event EventHandler StateChanged;
 
    public MySwitch()
    {
        InitializeComponent();
        SwitchIsON = true;
    }
 
    private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        if (SwitchIsON)
            TurnOffStoryBoard.Begin();
        else
            TurnOnStoryBoard.Begin();
        SwitchIsON = !SwitchIsON;
 
        if (StateChanged != null)
            StateChanged(this, null);
    }
}
Before we run our application only one thing remains. To add our brand new switch to the MainPage of our project. If you check your Toolbox again you will see our MySwitch control in it! So drag it in the Page and run our application.
That’s great isn’t it? We can actually use our own Control that was created to fit exactly our needs! So, are we done? We drew our control and animated it to fit our needs. We let it handle the user interaction by its own and we created an event to let our code know when its state is changed.
Well… let us just check one last thing.

Being user theme friendly

What if the user of the application changes the theme preferences of the phone? Let’s say to “light” and “blue”. Let’s see what will happen to our application?
That’s right… disaster. Where is our switch? We did so much to make it work with one theme only? Oh no, should I fill my code with if-then-else and switch-case statements to achieve my goal? Calm down! We will fix our control in a matter of seconds.
Go back to Expression Blend and open our project again. We have to change the colors we used to match the user's theme. To do so we will replace the white color we used in our rectangles with the PhoneContrastBackgroundBrush and the red color with the PhoneAccentBrush. You will find those brushes under the Brush Resources tab of the Brushes area. Save everything and lets run our application again.
Yes, now we are done!

UI guidelines of Windows Phone

UX/UI Guidelines for Windows Phone 8


I have been envying the Windows 8 team for their exclusive UX index, that helps you to build great Windows Store apps. Therefore, I have decided to be a pioneer and build a similar thing for Windows Phone 8. Here is a recommended checklist of things that you should consider when you are building your windows phone app. This list is not exhaustive. It should be used as a guide only. This blog has been consolidated from multiple resources, among them was the windows phone depth partner support (WPDPS) such a great resource that is done based on apps reviews and case studies. What make me thought about it, is that I didn’t find this source of information publicly available, so I thought of sharing and adding some tips and tricks in between. It is not new, it is just not well seen or acknowledge. Big thanks to the WPDPS and waiting for more and more of these to be directly incorporate in the windows phone dev center soon.

1- Elements Alignment and Margins

- All pages should respect the 12px or 24px margin on the left.
- Content, titles, headers, and header logos should be left aligned to 12px or 24px margin.
- If right alignment is required, the right edge margin will be also 12px or 24px.
           dps-ux-bar        dps-ux-bar_1
- Tip:  Check the semi-transparent grid of 25 × 25-pixel red squares on your application when running in debug mode. These squares are contained within a padding of 24 pixels around the page and are offset by 12 pixels between one another — the magic combo for Windows Phone design. The grid enables you to quickly and easily identify any alignment issues on the page.
  MetroGridHelper
- Field and value pairs should either be presented in two left aligned columns, or with the tile above the content as in the contact detail page in the people hub.
image    image   image

2- Element Spacing

Spacing between elements should be consistent both horizontally and vertically. It is recommended that elements are spaced a multiple or subdivision of 12px apart in order to follow the design grid.
image image imageimage

3- Control Feedback on Tap

- When using standard controls such as Buttons, List Items .. etc, should use the standard Windows Phone tilt effect.
- No background, foreground, or border color changes
- Other controls, no animation or color changes are permitted
- Color change of any description is not permitted for touch feedback

4- Lists

- Tilt animations must be used to indicate a list item has been pressed.
image      image
- List items should not have a selected state, unless in a picker.
- Use strong consistent typefaces across the app, make list item text at least 12 pixels in height and make it ease for touch, and make sure that the text is legible from all angles and sizes.
Backgrounds
- Backgrounds are discouraged. They are allowed for brand reasons and to support contrast. Instead, use any accent colors on the text foreground
Layouts
- Use text size and color to establish list item hierarchy. See the Photoshop templates for a full range of list templates.
Enhancements
- List enhancements should not be used unless they are distinct from one another, such as in a menu. A rule of thumb is that Icons in a circle represent actions and those without are for indication.
image
Scrollable Content
-If you have scrollable content on your page, you should put 95px bottom padding at the end of your content. This way the content doesn’t reach all the way to the very bottom of the page.
For example, here is a simple page that is slightly higher than the visible area:
image
- if the user scrolls to the end of the page, the rubber band effect will come into view and the content will be pulled slightly above the bottom. But once the scroll is released, the content bounces back down to the edge of the screen once again.
image
- While it doesn’t poke your eyes and it generally works OK, having content stretched all the way to the bottom is not ideal. The quick fix for this is adding 95px margin to the bottom to move your content away from the bottom – regardless if it is bottom of the phone chrome or the application bar. The final result is more pleasing to the eye.
image
- You can see the same padding in effect if you check the profile and history pages on any of your contact. It is also present on the new appointment page in the Calendar app and in the Internet Explorer’s settings page. Speaking of settings, scroll down to the bottom in the Settings application.

5- Pivot Controls

Pivot Pages
- All pivot controls should have at least two pages in them
Controls not permitted in Pivot
- Toggle switches
- Sliders
- Maps controls – unless they are static (pinch/zoom/pan are disable etc.)
- Browser controls - unless they are static (pinch/zoom/pan are disable etc.)
Gesture Competition
- Controls that provide a horizontally scrollable area or take a horizontal swipe gesture are not permitted in the pivot control as the horizontal swipe gesture is reserved for changing pivot pages.
            image
Empty Pivot Pages
- If a pivot page relies upon user interaction in order to populate it with content, then placeholder text/image should be included that indicates to the user that content is outstanding. For example, if there are no items displayed on an ‘Unread email’ pivot page, then the page should not be removed, it should simply state that no content is available at this time.
image
for more information check: Pivot control design guidelines for Windows Phone

6- Panorama Controls

Controls not permitted in Panorama
- Toggle switches
- Sliders
- Maps controls – unless they are static (pinch/zoom/pan are disable etc.)
- Browser controls - unless they are static (pinch/zoom/pan are disable etc.)
Application Bar
- Common actions such as refresh, search and settings should be placed in an application bar.
- The options available in the application bar can change contextually with the panorama pane.
- Floating buttons on the panorama should be avoided or be kept to minimum
Gesture Competition
- Controls that provide a horizontally scrollable area or take a horizontal swipe gesture are not permitted in the panorama control as the horizontal swipe gesture is reserved for changing panorama pages.
Scrollable Panes
- Panorama panes should either scroll vertically or horizontally. Not both.
image
- All panorama panes should not scroll vertically. If this is the case a pivot control is probably more suitable.
- Using a variety of panorama panes (vertical and horizontal) will improve the overall user experience and make the panorama easier to navigate.
Navigation
- Floating buttons should be avoided. If necessary provide a navigation section to allow users to dig deeper into the content.
- The native Pictures and Music & Videos panorama have good examples of this. Generic tasks should be placed in the panorama app bar.
  image
Interactive Content
- Minimize the use interactive content on the panorama (forms, search boxes etc.).
- Panorama controls should be used to entice the user to explore (i.e. overview about the app).
- Use only a small set of tasks at this level that are fresh, dynamic and compelling.
- The panorama control should not be your entire application.
Number of Panes
- A maximum of five panes are recommended. Any more than five and they will be difficult to navigate and performance will take a hit.
Background
- Panorama controls should have a background. These can be textures brand elements, graphics, photos.
- Ideally they should be engaging and where possible contextual.
Title
- The panorama title should be animated.
- The rate of motion for the panorama title is that it should be slow relative to the topmost content layer, and slower than the background art (if applicable).
Section Titles
- The font size should be larger than the corresponding content.Photoshop templates are available tofacilitate panorama design.
for more information check: Panorama design guidelines for Windows Phone

7- Headings

- Headings should be left aligned, and should not have backgrounds, borders, underline, or any other kind of decoration.
- The exception to this is panorama pane titles, which may use corporate branding.
- Also see text guidance section of this blog.

8- Buttons

Placement
- Wherever possible, buttons should be placed in the application bar.
Exceptions to this include:
image
- Panoramas - where guidance Error! Reference source not found may apply.
- Dialogs and settings where more verbose actions may be needed.
- Quick actions (for example call history on a Windows Phone)
  image
Close Buttons
- Windows Phone applications do not need close buttons, as closing actions are handled by the hardware back button.
Back Buttons
- Back buttons are not permitted anywhere in Windows Phone. The user will make use of the hardware back button on the device.
Home Buttons
- Home buttons should be avoided as they can prove problematic to the Windows Phone navigation model. This becomes most evident if a user actions both the home button and the hardware ‘back’ button to navigate which may result in a loop effect.

9- Pickers

- The standard pickers should be used for picking the date and/or time, or for choosing a letter of the alphabet.
- Should a nonstandard picker be required, these should follow the look and feel of the ringtone picker in the Settings app on the device.

10- Start Tiles

Primary Tiles
- Start tiles should not have rounded corners or three dimensional elements to them. They should fit in with the look and feel of other items in the Start menu.
        image
- Ensure standard tile templates are used
- The app logo should appear in the space dedicated to it in the template
- Logos should not be duplicated on the tile
- If the name of the app is included as part of the tile image, then the app name should be removed from the manifest to avoid it appearing twice
- Avoid including localized text in image files for tiles
- Start tiles should avoid having a full black (#000000) or full white (#FFFFFF) background, as these will not render properly in the dark or light themes.
Avoid using relative time stamps or dates (eg. ‘two hours ago’). This is a static statement and will become inaccurate as time progresses. Instead, use an absolute date or time (eg. ’14:00’)
Secondary Tiles
- Secondary tiles should not link to static content
- Secondary tiles should not interact with the app (eg. ‘skip to next track’)
- Good examples include pinning a news category that updates regularly or a specific stock with an updating share price
- Avoid pinning to content that may not be available to users when they access the app at a later date (eg. a specific news article that is no longer current and has been replaced)
Wide Tiles
- The wide tile should only be used to display new, interesting content and notifications which are updated frequently (at least weekly).
- Wide tiles must be live.
   image
for more information check: Tile design guidelines for Windows Phone

11- Browser Controls

- Browser controls should not be embedded in any pages in an app. The user should always be taken off to Internet Explorer on the device.
- Links that navigate a user away from the app should clearly state that this will happen.
Exceptions
- Where the user is being taken to a single page for authentication (such as with Facebook or Twitter), and no Xauth or similar API is available for the authentication controls to be implemented in Silverlight controls, the authentication can be performed in an embedded web browser control in the application.

12- Dialog Boxes

- Use the standard Windows Phone Dialog box. Single buttons should be left aligned and multiple buttons centre aligned.
- Avoid creating custom dialog boxes – If this is unavoidable ensure the behavior of the custom control mimics that of the native dialog box.
         image
- The Windows Phone toolkit also has a dialog control that allows for a greater degree of customization.
for more information check: http://msdn.microsoft.com/en-US/enus/library/microsoft.xna.framework.gamerservices.guide.beginshowmessagebox.aspx

13- Contrast

- There must be sufficient contrast between the background and foreground of controls on the page.
- This is particularly important for panoramas, where the background image can often interfere with the legibility of text. If this happens, either replace the image, or apply a semi-transparent black (or grey) layer over the image.

14- Text

Text Case
- Titles in Windows Phone should always be lowercase with the exception of section titles which should be all uppercase. If brand guidelines insist on a different case, then ensure that the use of the case is consistent across the app.
Custom/Brand Typefaces
- Custom or brand typefaces can be used in moderation in the application, though care should be taken. Custom typefaces can be used for page titles or panorama section titles. Segoe WP should be used everywhere else.
- Be careful if the typeface closely resembles Segoe WP, such as Arial or Helvetica, as mixing these with Segoe can look odd.

15- Images

- Images used within the application on backgrounds or UI elements should properly fit the application.
- Aspect ratios should be respected, images should not be pixilated or smudged as a result of scaling, and images with transparency should have proper anti-aliasing to ensure they display properly on different colored backgrounds.
- For most apps, we recommend that you include only WXGA assets. WXGA assets have the highest quality, and they automatically scale to work well for other resolutions. Multi-resolution apps for Windows Phone 8
        image

16- Icons

Metaphors
- Don’t mix metaphors. Users recognize certain icons to mean certain things, either because they are used elsewhere in the device or because they are commonly associated with something else. For example:
 image
- If no icon exists for the metaphor you are trying to convey, create one. Do not repurpose existing icons.
Look and Feel
- Icons should respect the Windows Phone design style look and feel – simple, one color, and two dimensional.

17- Touch Targets

- Ensure your application is optimized for touch.
- Minimum font size is 15pt
- Recommended touch target size is 9mm
   UX_Interactions_SmallAssets_03
- Minimum touch target size is 7mm
   UX_Interactions_MinHitTarget
- Minimum spacing between elements is 2mm
  UX_Interactions_SmallAssets_02
- Visual size is 60-100% of the touch target size 
- Provide feedback when an item is touched
            image

18- Typos

- The app should not have any spelling mistakes.
- Copy that is spelt incorrectly looks bad and could negatively impact the brand perception.

19- Theme

- The application should either respect the theme and accent color changes of the device, or should have a fixed theme that is not affected by such changes.
- All elements should be visible and have appropriate levels of contrast regardless of theme.

20-  Splash Screen

- Provide different splash screens for the different resolutions
         image

21- The Hardware Back Button

- The hardware back button should always allow a user to complete one of the following tasks:
      1. Dismiss temporary UI elements such as dialogs, keyboards (SIP) or pick lists.
      2. Move backwards through the back stack.
- The back button must not be altered under any circumstances. This includes its behavior when implementing secondary tiles (please refer to section 4.1.22)

22- Secondary Tiles (deep linking)

- Secondary tiles are designed to launch the user into specific areas of the application. They are designed to allow quick and easy access to content and are generally not used as an entry point for exploration.
- Good examples of secondary tiles can be found on the device itself. For example, a pinned album from music and video will play the album when tapped. The tile serves as a specific purpose – go to the album and play it.
- Users can also pin people to the Start screen. Tapping on one of these tiles takes the user into the contact card pivot where they can see all the information and tasks related to that specific contact.
- Pressing the hardware back button returns the user to the Start screen.
Pinning
- The Pin icon should be used in the application bar to indicate that an item/section of the app can be pinned to the start screen. Please do not repurpose existing icons.
- Pinning can also be activated by using the touch and hold context menu – this is available in the Windows Phone toolkit.
- The pinning action should always be initiated by the user, or permission from the user should be sought. Do not pin items to a user’s Start screen without requesting their permission first.
Hardware Back Button
When a user launches an application by tapping on a secondary tile, pressing the hardware back button should exit the application (i.e. return to the Start screen). The behavior of the hardware back button should not be altered in any way.

23- Lock Screen

- Background images should contain minimal text to avoid conflict with on-screen messages
- Background images should be simple – ‘busy’ images affects the legibility of on-screen messages and notifications
- Logos should be kept small to avoid competition with date, time and notifications
- If text is included, it should related directly with the image
- The visual focus of the lock screen should be the image, not the logo or text
            image         image

24- Lens Design 

- Apps should support a left-pointing arrow icon to indicate that additional photos are available
- The animation for ‘Save’ and ‘Capture’ should be consistent
- Tap-to-tap capture and the camera hardware button should be supported
- Half-press to focus should be supported
- Focus brackets should function as they do for the basic camera where relevant
- Capture and confirm apps should use a consistent set of icons (‘save’ and ‘delete’) along with animation for confirming and cancelling the storage of the item.
- ‘Cancel’ and ‘save’ should return the user to the viewfinder. These icons are included with the Windows Phone SDK.
Rich Media Open Link
- The open link should launch an experience tailored to viewing or editing a selected item and not action a generic app launch point
- Displaying branding elements on items stored in the camera roll should be avoided – users should be able to share and edit these items without visual distractions
for more information check: Lens design guidelines for Windows Phone

25- Page Transitions

- Animations should be implemented when moving between pages. This effect is available from the Silverlight for Windows Phone Toolkit.
             image
- couple of page transitions are included in the Silverlight for Windows Phone Toolkit:
  • Turnstile - To transition between contextually different areas
  • Swivel - Partial and transient UI
  • Slide - Staying in context while showing a set of options, and No forward navigation
  • Tilt – Natural feedback a control is pressed
- Use a bar to indicate progress
  • Just as you use tilt animation to indicate to the user that their tap has taken effect, progress bars enable you to communicate that a process is being executed. This removes doubt for the user about whether the application is functioning properly. Two types of progress bars can be used: determinate and indeterminate.

    Determinate progress bar.
       
          Indeterminate progress bar.
  • A determinate progress bar is used to communicate the percentage of completion, such as the percentage of bytes copied out of the total number of bytes. An indeterminate progress bar is much more common and is particularly useful when you don’t know the length of the process, such as when calling a Web service and waiting for a response.

26- Language and Tone

- Do not use computer jargon, hexadecimal error codes, or text that assumes computer knowledge.
- Use an authentic and clear tone and reflect the language that is used by the audience.
- Use friendly, light hearted and empathic tones. Never use angry or mechanical tones in the application.

In Conclusion

These are just recommendations from different cases studies that are usually application specific. So, feel free to do what is right for your application taking into consideration some success factions like:
- Deliver the best experience on any mobile platform is to design the app for the platform and its accompanying usage patterns.
- The first step in building a compelling Windows Phone UI-compliant application is to spend time using the apps that ship with the OS. This will familiarize you with Windows Phone’s unique set of controls and design paradigms.
- Get inspired by checking well designed third-party apps that are available on the Windows Phone Marketplace. one of my favorites apps that have innovated on the Windows Phone design principles to deliver a truly compelling experience, is Cocktail Flow app.
Once you have the basics down and have begun to piece together the visuals for your application, refer to the guidelines in this article. They will help you avoid some of the most common mistakes that I have seen when reviewing designs or during building my own apps.