Over a million developers have joined DZone.

5 least known things – Windows Phone 7 development

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

The WP7 emulator supports hardware keyboard input

No, I am not talking about phones with hardware keyboards (doh – it’s the emulator) – I am actually talking about the keyboard you are using for development on your own computer. To do this, you need to get focus on a text field and press PageUp on your keyboard. The virtual keyboard (that is tied to the emulator) will instantly slide down and you will be able to type. You will even get word completion suggestions:

This is really handy when you want to work with applications where you need to enter long strings – e.g. URLs and typing it each time with the help of the mouse and the virtual emulator keyboard might not be that interesting. To return to virtual keyboard mode, press Page Down.

BONUS HINT: Pressing the Windows key while the hardware keyboard is activated in the emulator will exit the application and return to the main menu.

You can use text suggestions and some custom keyboard layouts in your applications

There are currently 10 custom SIP (Software Input Panel) layouts defined, as stated in the official documentation. Each of these can be used accordingly to make the input much faster. When a TextBox is used, you can specify the SIP layout to be used via InputScope:

<InputScopeName NameValue="Text"/>

Using Text as the type will allow you to use suggestions (from a pre-built dictionary) to make sure that you are entering the correct words.

Here is how other layouts look like.









You can access the camera. Or, at least the camera application.

If your application is dependent on the camera installed in a Windows Phone 7 device, then there are good news for you - it is possible to test the camera access layer directly in the emulator. This is done via CameraCaptureTask:

CameraCaptureTask task = new CameraCaptureTask();
task.Completed += new EventHandler<PhotoResult>(task_Completed);

The event handler that will help you get the newly obtained image:

void task_Completed(object sender, PhotoResult e)
// e.ChosenPhoto - photo stream

Probably not quite the camera you expected to see, but it is great for simulation and testing purposes, so don't hesitate to use this when needed - if it will work here, it will work on the device.

You can access locked (bundled) pictures that are on the emulator

There are 7 photos that are bundled with the OS image used by the Windows Phone 7 emulator. And you can access all of them. For example, you work on an image processing application and you need to test some filters. Instead of downloading images from the web, you can use those that are accesible directly.

NOTE: You cannot remove or overwrite these images.

Simply use PhotoChooserTask to access the gallery:

PhotoChooserTask task = new PhotoChooserTask();
task.Completed += new EventHandler<PhotoResult>(task_Completed);

If I would want to test this functionality, I would put a sample Image control on the page and then use task_Completed to set the image source to the selected photo:

void task_Completed(object sender, PhotoResult e)
BitmapImage image = new BitmapImage();
image1.Source = image;

If you want to, you can even send these pictures to your email account or to a web service - they come in pretty decent resolutions. However, I would only recommend using these pictures for testing purposes only, since you don't own any legal rights on them.

There are default contacts installed. Use them!

For testing purposes, the emulator comes pre-loaded with a bunch of contacts. If you know that your application is going to use the user's phone book, PhoneNumberChooserTask is the way to go.

PhoneNumberChooserTask task = new PhoneNumberChooserTask();
task.Completed += new EventHandler<PhoneNumberResult>(task_Completed);

void task_Completed(object sender, PhoneNumberResult e)

NOTE: You can only get the phone number via this method. At least in this release of the SDK.

The result I get once the selection is made:

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}