Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780735663251-files/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Foreword
So, youre curious about Windows Phone development? Welcome aboard! Whether youre an existing Microsoft Silverlight developer wanting to branch out into the mobile space, an existing mobile developer looking to extend your reach across a second or third ecosystem, a rising star whos ready to create the Next Big Thing and take the world by storm, or maybe just a curious phone user who wants to know what all the app fuss is about, Windows Phone is the platform for you.
Getting started with Windows Phone development is free and easy; everything you need to write apps is just a couple of clicks away. You can have your first app up and running in a matter of minutes, even if you know next to nothing about Windows Phone development or dont even own a device. As your apps become more ambitious and you encounter more complex development issues, a vibrant developer community on the web is ready and willing to help you out along the way. Mastery of this platform, with its rich feature set, unique application model, integrated end-to-end experiences, and burgeoning international marketplace, takes time and effortand an expertly written guide. Luckily for you, this book is just such a guide.
The Windows Phone platform stands on the shoulders of giantsgiants such as Silverlight, XNA, Microsoft Visual Studio, and Microsoft Expression Blendand as we built the platform, we embraced the power and familiarity that these existing technologies afforded us; our goal was to introduce new concepts only when strictly necessary to enable new scenarios, and to re-use existing concepts everywhere else. We spent less time re-solving old problems (such as navigation and microphone capture) and more time tackling new ones so that we could ship a vast array of new phone-specific APIs for developers to wrap their heads aroundcameras, gyroscopes, multi-tasking, phone integration, user data access, and live tile updates, just to name a fewand Andrew covers all of them (and more!) in this book.
As youve probably heard (and seen), Windows Phone ushered in a new design language for Microsoft, code-named Metro. Adhering closely to this design is critical when building user experiences that will delight and engage your customers. As you would expect, the Windows Phone developer tools give you a big helping hand in this department, providing user interface elements and application templates that just work by default. Nevertheless, as the owner of your applications overall experience you are ultimately responsible for ensuring it performs optimally, adhering not just to the graphic design rules, such as content over chrome, but also the fast and fluid interaction model that your customers will come to expect. Throughout this book youll find practical examples and guidance that show how to embody the Metro design language in your applications, along with examples of common pitfalls and how to avoid themparticularly with respect to application performance and responsiveness, which are key factors in user satisfaction (and hence, app ratings and profitability).
On a more personal note, I was thrilled when Andrew asked me to tech-review this book (although writing this foreword was more than a little daunting!). As an infrastructure guy at heart, I love building platforms and enabling developers to be successful on top of them, but there are only so many people you can reach via blogs or conference speaking sessions. Ive been asked to author books before, but Ive never had the time or inclination to do so. By piggybacking on Andrews hard work with this book, I feel like Ive made a differenceif only a small oneand that makes me grateful for the opportunity. I also learned a lot while reviewing this book, and I know that you will, too.
Peter Torr
Program Manager in the Windows Phone Application Platform team
Introduction
The smart phone is increasingly important in peoples daily lives. It is used for a wide variety of tasks, both work-related and non-work related. People use smart phones to keep up to date with friends and family, for relaxation, and for entertainment, as well as for viewing documents and spreadsheets, surfing the Internet, and enriching their lives. There is therefore considerable scope for building smart phone applications. Windows Phone is not just another smart phone; rather, it is positioned as an opportunity for developers to build applications that can make a real difference to peoples lives. The platform has been designed from the ground up to support an all-encompassing, integrated, and attractive user experience.
Windows Phone 7 Development Internals covers the breadth of application development for the Windows Phone platform, both the major 7 and 7.1/7.5 versions and the minor 7.1.1 version, and shows how you can build such compelling and useful applications. You can build applications for Windows Phone 7.x by using either the Microsoft Silverlight runtime or the XNA runtime. This book focuses on Silverlight applications. The primary development and design tools are Microsoft Visual Studio and Microsoft Expression Blend. Here again, this book focuses on Visual Studio.
Each chapter covers a handful of related features. For each feature, the book provides one or more sample applications and walks you through the significant code (C# and XAML). This will help you to understand the techniques used and also the design and implementation choices that you have in each case. Potential pitfalls are called out, as are scenarios in which you can typically make performance or user experience improvements. An underlying theme is to conform not only to the user interface design guidelines, but also to the notion of a balanced, healthy phone ecosystem.
Who Should Read This Book
This book is intended to help existing developers understand the core concepts, the significant programmable feature areas, and the major techniques in Windows Phone development. The book is tailored for existing Silverlight developers that want to jump into the exciting world of mobile application developer with the Windows Phone platform. Developers experienced with other mobile platforms will find this book invaluable in learning the ins and outs of Microsofts operating system, but will likely need additional resources to pick up C# and XAML languages.
The Windows Phone 7 release only supports C#, and although support for Visual Basic was introduced with the 7.1 SDK, this book focuses purely on C# and XAML. The basic architecture of the platform is covered in , and most chapters go deeply into the internal behavior of the system. This is knowledge that helps to round out your understanding of the platform, and inform your design decisions, even though, in some cases, the internal details have no immediate impact on the exposed API.
Assumptions
The book assumes that you have a reasonable level of experience of developing in managed code, specifically in C#. Basic language constructs are not discussed, nor is basic use of Visual Studio, the project system or the debugger, although more advanced techniques, and phone-specific features are, of course, explained in detail. You should also have some knowledge of XAML development, preferably in Silverlight, although Windows Presentation Foundation experience would also be useful background.