Silverlight and Windows Phone 7

0
125

In enterprise scenarios, and in many consumer scenarios other than media-rich applications and games, Silverlight is the optimum choice of development platform for Windows Phone 7 applications. The Tailspin Surveys example application described in this guide is a Silverlight application, although it does use interop to XNA to implement some features that are not accessible from Silverlight.

Windows Phone 7 supports almost the full capabilities of Silverlight 3, though there are some minor differences in the way it works, compared to Silverlight hosted in a web browser. For example, Windows Phone 7 does not support printing, and most of the visual controls are different to suit the UI requirements of the device, but the core programming platform is almost identical. If you are familiar with Silverlight, you will be immediately productive on Windows Phone 7.

UI design for the phone can be accomplished in Microsoft Visual Studio® 2010 development system and in Microsoft Expression Blend® 4 design software, both of which support creating Silverlight applications for Windows Phone 7.

In addition, tools and frameworks are increasingly available for working with and extending Silverlight on Windows Phone 7. These include testing tools, additional controls, and frameworks for implementing common design patterns. Some examples are the patterns & practices Prism Library, Ninject (see http://ninject.org/), and Moq (see http://code.google.com/p/moq/).

This guide demonstrates how you can use well-known design patterns that are well suited to Silverlight, such as Model-View-View-Model and Dependency Injection. Common development techniques, such as data binding for UI controls, and test driven development can be applied to Windows Phone 7 applications in the same way as for desktop and server applications.

Note: For information about developing Windows Phone 7 applications with Silverlight, see Appendix A, “Tools, Frameworks, and Processes.” For information about the major differences between Silverlight and XNA, see Appendix B, “Silverlight and XNA in Windows Phone 7.”

However, there are some challenges when using Silverlight on Windows Phone 7 compared to the experience when using it in a web browser. For example, multitasking capabilities are limited, and the program itself cannot run in the background. Events such as a phone call arriving on the device will stop your application from running, and
you must preserve state so that your application can correctly resume when required or can gracefully exit if the system requires the memory or resources it is using.