Windows Phone 7.5 Unleashed
Daniel Vaughan
800 East 96th Street, Indianapolis, Indiana 46240 USA
Windows Phone 7.5 Unleashed
Copyright 2012 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33348-4
ISBN-10: 0-672-33348-1
The Library of Congress Cataloging-in-Publication Data is on file.
Printed in the United States of America
First Printing March 2012
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact
U.S. Corporate and Government Sales
1-800-382-3419
For sales outside of the U.S., please contact
International Sales
Editor-in-Chief
Greg Wiegand
Executive Editor
Neil Rowe
Development Editor
Mark Renfrow
Managing Editor
Kristy Hart
Project Editor
Betsy Harris
Copy Editor
Geneil Breeze
Indexer
Heather McNeill
Proofreaders
Williams Woods
Publishing
Jess DeGabriele
Technical Editor
J. Boyd Nolan
Publishing Coordinator
Cindy Teeters
Book Designer
Gary Adair
Compositor
Nonie Ratcliff
Foreword
Dear Windows Phone 7.5 Unleashed reader,
Welcome to the ranks of the many developers trying to achieve richness or fame in this new and exciting platform. It has been a year since Windows Phone 7 launched (and 1.5 years since it was announced). You are joining the ranks of thousands of registered developers who delivered more than 30,000 apps within the first year after launch. Windows Phone developers are having a lot fun because we have the best tools and, (especially) with this Windows Phone Mango release, one of the best platforms. Dont worry if you are just getting started; the business opportunity is still in its infancy. You are still on time (if you hurry), and you are in luck because you now have in your hands (or on your screen) one of the best tools for delivering compelling, well-architected, maintainable Windows Phone applications. That tool is this book: Windows Phone 7.5 Unleashed.
I have known Daniel, your author, for about four years. We first met as part of the WPF Disciples, an elite group of XAML experts that spent countless hours passionately discussing and sharing patterns and best practices for .NET and Silverlight application development. Within the group, Daniel is well respected for his knowledge and recognized for his always optimistic attitude toward raising the bar (both on quality and experience) on projects he works on. As usual, he has raised the bar with this epic 16-month writing effort.
Windows Phone 7.5 Unleashed is much more than a great introduction to Windows Phone development. Besides providing a comprehensive view of the platform, where this book excels is in striking the perfect balance between great samples, good and detailed explanations, insightful tips, andmost importantlyreal-world experiences and real-world best practices. While other Windows Phone books simply introduce a concept like the application bar, Daniel provides great wrappers or abstractions to improve the development experience. Other books might oversimplify a sample to keep a chapter focused on the topic, but Daniel delivers a useful, real-world example that is more interesting and comprehensive. I cant say he keeps it shortat about 1,200 pages this is not a brief bookbut it is an easy read because of its focus and carefully editorialized relevance. I could go on citing examples of Daniels thoroughness (maybe one more since I am confident few books will have unit testing or input validation chapters), but instead I will let you get to the task at hand: building your Windows Phone apps.
Enjoy the journey!
Happy Windows Phone coding!
Jaime Rodriguez
Principal Evangelist, Microsoft
P.S. To Daniel (and the Sams team):
I know you spent more than a year writing this book and when facing tough decisions, such as what to cut or whether to hold off the book to cover Mango instead of releasing a book that was going to be out-of-date at print, you always made the right calls for the readers. The book shows it.
Congratulations!
Preface
Windows Phone OS is Microsofts new mobile phone operating system. It is a substantial departure from Microsofts previous Windows Mobile technology, as it provides the capability to develop applications for the mobile phone using either Silverlight or XNA. Silverlight, in particular, is a technology that has seen rapid adoption for multimedia web development and desktop line of business applications. Extending the Silverlight development experience to the phone was welcome news to many Silverlight developers because it opened up many exciting opportunities. Silverlights key advantage is that it brings increased productivity to developers.
Windows Phone offers developers the opportunity not only to target the phone OS but also to build cross-platform games and applications that run on the desktop and in the browser: on Windows, Linux, and the Mac. In addition, Windows Phone supports integration with XBox Live and Zune services.
Many features make Windows Phone compelling, such as the phones built-in services for geographic location, multitouch capabilities, and hubs, which combine both local and online content. Most importantly, the tooling and platform make it fun to develop for.
Windows Phone has a friendlier tiled interface than its predecessor and has been designed around the Metro UI philosophy. The Metro UI philosophy had its origins in the ill-fated Zune media devices. The large typography and fluid scrolling lists make Metro beautiful and highly suited to mobile devices. We now see the Metro language making it to the tablet and desktop environment with Windows 8. Likewise, the application marketplace paradigm will also accompany the release of Windows 8, and like Windows Phone, Windows 8 Metro apps will operate in a sandboxed environment, with fewer capabilities than their fully trusted desktop counterparts. The sandboxing of Windows Phone and Windows 8 Metro apps ensures that the user never has a bad experience with an app. What does this have to do with Windows Phone, you may ask. It is important to recognize the evolution of these various technologies, to have an eye on the future, and to prepare for the likely convergence of the technologies. A total convergence of Windows Phone and Windows desktop OSs may happen at some point. Yet, until it does, both OSs will continue to drive innovation in the other. New features of the Windows Metro UI will undoubtedly make their way to the phone OS over time, and vice-versa. There was, and continues to be, some uncertainty about Silverlight, especially on the browser. Silverlight on Windows Phone, however, is alive and well, and with the upcoming release of Windows 8 and the incorporation of the Metro UI in Windows 8, demand for developers with skills in this area is set to rise.