Book Image

Windows Phone 7 Silverlight Cookbook

By : Robb Schiefer Jr., Jonathan Marbutt, Robb Schiefer
Book Image

Windows Phone 7 Silverlight Cookbook

By: Robb Schiefer Jr., Jonathan Marbutt, Robb Schiefer

Overview of this book

Silverlight has revolutionized development using Microsoft technologies. It is an excellent tool for mobile application development. The XAML-based markup and familiar C# code are the perfect combination for building apps efficiently and with minimum hassle.Packed full of recipes containing comprehensive instructions for the tasks required to build modern compelling smartphone apps using Silverlight.Starting with application design and architecture, you will quickly move on to more technical features and APIs you can implement to make your app stand out. You will use the Camera API to scan barcode, location services to pinpoint the user’s GPS coordinates and accelerometer to provide feedback based on movement of the phone. All of these features can be provided in a slick user interface through the power of Silverlight. Animations, behaviors and XAML provide all you need and more.
Table of Contents (18 chapters)
Windows Phone 7 Silverlight Cookbook
About the Authors
About the Reviewers


In this book, you will discover the latest development technology from Microsoft for the Windows Phone 7. We will cover all that you need to get a variety of applications developed. Throughout this book you will find many simple examples that stand by themselves to help provide quick reference to many of the common needs for a Windows Phone developer.

What this book covers

Chapter 1, Layout and Design, covers the most common ways to lay out your Windows Phone application that will provide you with the basics for designing applications. We will cover the basics of Expression Blend and its important role in Windows Phone Application development.

Chapter 2, Creating Animation, explains that understanding the basics of animations is no longer a tool just for designers, but it can play an important role in your application to give it the polish to make your application stand out from the crowd. Through this chapter, we will cover the basics of creating simple animations with both Storyboards and Visual State Manager.

Chapter 3, Behaviors and Events, explains now that you have the design aspects down for your application, it is time to give the user a way to interact with the application. In Windows Phone development, much of the initial interaction can be fired by both behaviors and events. We will show you some built in behaviors as well as developing custom behaviors.

Chapter 4, DataBinding 101/MVVM, covers the basic understandings of databinding in Silverlight as well as the MVVM design pattern as most apps have some data to populate and display. With MVVM, you can architect your application for much easier maintenance as well as easier testing and design time support for data.

Chapter 5, Services, Data, and RSS, explains that once you have a great understanding of how to structure an application to show data as well as the basics of databinding, it is now time to dig into pulling data from services. In this chapter, we will cover the basics of using WCF services as well as building a simple RSS reader.

Chapter 6, Location Services: Are you lost? Start using GPS coordinates and other location information from the phone in your apps with this chapter. We cover how to efficiently use location services, utilize the emulator for debugging your app, and using the built-in mapping control.

Chapter 7, Push Notifications to the Phone, shows how poling for data every 10 minutes is so 1995. This chapter covers setting up push notifications to the phone. Learn how the Microsoft Push Notification Services work and how you can leverage them to make your app the coolest on the block. Topics include start tile notifications, toast notification, and even a helper class to get you going faster.

Chapter 8, Launchers and Choosers, launches your app into Windows Phone 7 with tight integration through Launchers and Choosers. Start using the phone's core features like sending e-mails, starting up the web browser, and working with the camera or stored photos in this chapter. Learn how these APIs can be utilized with ease to make your app shine.

Chapter 9, Sensing with Sensors, covers the various sensor APIs to find what makes smartphones smart. Learn how to use the accelerometer, microphone, and touchscreen in your apps for a truly engaging end-user experience.

Chapter 10, Preparing Apps for the Marketplace: It's time to get rich and famous. It's time to share your app with the world in the Windows Phone Marketplace. Learn all the ins and outs of submitting an app to the marketplace and benefit from our experience. Topics include avoiding failed verifications, adding trial support, creating icons, and a step-by-step walkthrough of app submission.

What you need for this book

For this book, you will need the following:

  • Visual Studio Express for Windows Phone

  • Expression Blend for Windows Phone

  • Windows Phone SDK

The tools can be downloaded for free at

Who this book is for

This book is for both the hobbyist and professional developer wanting to begin development for Windows Phone development. Throughout the book we tried to take the most simplistic approach for complex problems to provide you with the quickest reference to many common scenarios.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "After finding the control in the assets window, drag-and-drop them onto your control.Blend."

A block of code is set as follows:

<VisualTransition GeneratedDuration="0:0:1">
<ExponentialEase EasingMode="EaseInOut"/>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<DoubleAnimation Duration="0" To="26" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We need to create a new Windows Phone Application after clicking New Project in Visual Studio".


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.