Windows Phone 7 Silverlight Cookbook
()
About this ebook
Related to Windows Phone 7 Silverlight Cookbook
Related ebooks
Near Field Communication with Android Cookbook Rating: 0 out of 5 stars0 ratingsWindows Phone 7.5 Data Cookbook Rating: 0 out of 5 stars0 ratingsPhoneGap 4 Mobile Application Development Cookbook Rating: 0 out of 5 stars0 ratingsOpenLayers 3.x Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsMicrosoft .NET Framework 4.5 Quickstart Cookbook Rating: 0 out of 5 stars0 ratingsWebRTC Cookbook Rating: 0 out of 5 stars0 ratingsIonic Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Windows Workflow Foundation 4.0 Cookbook Rating: 0 out of 5 stars0 ratingsSwift Cookbook Rating: 5 out of 5 stars5/5Android Studio Cookbook Rating: 4 out of 5 stars4/5Delphi Cookbook - Second Edition Rating: 5 out of 5 stars5/5Ionic Framework By Example Rating: 2 out of 5 stars2/5Flash Development for Android Cookbook Rating: 3 out of 5 stars3/5Objective-C Memory Management Essentials Rating: 0 out of 5 stars0 ratingsMagento Mobile How-to Rating: 0 out of 5 stars0 ratingsAlfresco 3 Cookbook Rating: 0 out of 5 stars0 ratingsFreeSWITCH 1.6 Cookbook Rating: 0 out of 5 stars0 ratingsPhoneGap Essentials Rating: 0 out of 5 stars0 ratingsScratch Cookbook Rating: 0 out of 5 stars0 ratingsIonic 2 Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsSignalR Realtime Application Cookbook Rating: 0 out of 5 stars0 ratingsOpenGL Data Visualization Cookbook Rating: 0 out of 5 stars0 ratingsOpenNI Cookbook Rating: 0 out of 5 stars0 ratingsHLSL Development Cookbook Rating: 0 out of 5 stars0 ratingsAndroid NDK Game Development Cookbook Rating: 0 out of 5 stars0 ratingsDelphi Cookbook Rating: 0 out of 5 stars0 ratingsVisual Studio 2013 and .NET 4.5 Expert Cookbook Rating: 4 out of 5 stars4/5Service Worker Development Cookbook Rating: 0 out of 5 stars0 ratingsLucene 4 Cookbook Rating: 0 out of 5 stars0 ratingsQt5 C++ GUI Programming Cookbook Rating: 0 out of 5 stars0 ratings
Information Technology For You
Summary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Computer Science: A Concise Introduction Rating: 4 out of 5 stars4/5ChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5How To Use Chatgpt: Using Chatgpt To Make Money Online Has Never Been This Simple Rating: 0 out of 5 stars0 ratingsWindows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5Supercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsHealth Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsLinux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5CompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsPanda3d 1.7 Game Developer's Cookbook Rating: 0 out of 5 stars0 ratingsPractical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5A Mind at Play: How Claude Shannon Invented the Information Age Rating: 4 out of 5 stars4/5Cybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratingsQuantum Computing for Programmers and Investors: with full implementation of algorithms in C Rating: 5 out of 5 stars5/5Hacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5The Programmer's Brain: What every programmer needs to know about cognition Rating: 5 out of 5 stars5/5The Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/520 Windows Tools Every SysAdmin Should Know Rating: 5 out of 5 stars5/5Computer Organization and Design: The Hardware / Software Interface Rating: 4 out of 5 stars4/5The Ultimate Guide to Landing a Network Engineering Job Rating: 0 out of 5 stars0 ratingsInkscape Beginner’s Guide Rating: 5 out of 5 stars5/5
Reviews for Windows Phone 7 Silverlight Cookbook
0 ratings0 reviews
Book preview
Windows Phone 7 Silverlight Cookbook - Jonathan Marbutt
Table of Contents
Windows Phone 7 Silverlight Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Layout and Design
Introduction
Downloading the tools
Understanding the tools
Visual Studio 2010 Express
Expression Blend for Windows Phone
Windows Phone Emulator
Also included in the download
Creating simple navigation
Getting ready
How to do it...
How it works...
There's more...
Using Positioning controls
Getting ready
How to do it...
How it works
Discovering the various input controls
Getting ready
How to do it...
How it works
There's more...
ViewStateManager introduction
Getting ready
How to do it...
How it works...
There's more...
Understanding the panorama control
Getting ready
How to do it...
How it works...
Using the pivot control
Getting ready
How to do it...
How it works...
2. Creating Animation
Introduction
Using ViewStateManager to create simple animations
Getting ready
How to do it...
How it works...
The basics of timelines
Getting ready
How to do it...
How it works...
There's more...
Using timelines for feedback to users
Getting ready
How to do it...
How it works...
3. Behaviors and Events
Introduction
Understanding events
Getting ready
How to do it...
How it works...
There's more...
Understanding basic behaviors
Getting ready
How to do it...
How it works...
There's more...
ControlStoryBoardAction
GoToStateAction
PlaySoundAction
Custom behavior
Getting ready
How to do it...
How it works...
There's more...
Physics engine behavior
Getting ready
How to do it...
How it works...
There's more...
4. DataBinding 101/MVVM
Introduction
A case for MVVM
Separation of Concerns
Testability
Reusability
Creating a simple model
Getting ready
How to do it...
There's more...
Creating a ViewModel
Getting ready
How to do it...
There's more...
Creating a view
Getting ready
How to do it...
How it works...
Element-to-element binding
Getting ready
How to do it...
How it works...
5. Services, Data, and RSS
Introduction
Creating a WCF service to access a SQL database
Getting ready
How to do it...
How it works...
There's more...
Using a WCF service in a Windows Phone application
Getting ready
How to do it...
How it works...
Building a simple RSS reader
Getting ready
How to do it...
How it works...
6. Location Services
Introduction
Tracking latitude and longitude
Getting ready
How to do it...
How it works...
See also
Tracking altitude, speed, and course
Getting ready
How to do it...
How it works...
There's more…
See also
Saving battery by using a location wisely
Getting ready
How to do it...
How it works...
See also
Using location services with the emulator
Getting ready
How to do it...
How it works...
There's more…
See also
Mapping your location
Getting ready
How to do it...
How it works...
7. Push Notifications to the Phone
Introduction
Updating the tile background without push
Getting ready
How to do it...
How it works...
There's more...
Creating a service to send notifications
Getting ready
How to do it...
How it works...
Registering for push notifications
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a notifications helper
Getting ready
How to do it...
How it works...
See also
Creating toast notifications
Getting ready
How to do it...
How it works...
There's more...
Authenticated Push Notifications
8. Launchers and Choosers
Introduction
Automating e-mails
Getting ready
How to do it...
How it works...
Handling common About Us tasks
Getting ready
How to do it...
How it works...
Scanning barcodes
Getting ready
How to do it...
How it works...
There's more...
Debugging tips
Trigger happy Chooser
Enabling photo extras
How to do it...
How it works...
There's more...
Tombstoning
Getting ready
How to do it...
How it works...
There's more...
Methods of persisting state
Not all Launchers and Choosers are the same
Tombstone events
9. Sensing with Sensors
Introduction
Orienting your app
Getting ready
How to do it...
How it works...
There's more...
PortraitDown orientation
That mic is hot
Getting ready
How to do it...
How it works...
Accelerating your apps
Getting ready
How to do it...
How it works...
Developing the touch
Getting ready
How to do it...
How it works...
Shaking it up
Getting ready
How to do it...
How it works...
Pinching with ease
Getting ready
How to do it...
How it works...
There's more…
10. Preparing Apps for the Marketplace
Introduction
Configuring capabilities
Getting ready
How to do it...
How it works...
There's more...
Automated capabilities detection
Maintaining responsiveness
Getting ready
How to do it...
How it works...
Adding trial support
Getting ready
How to do it...
How it works...
There's more...
Creating iconography
Getting ready
How to do it...
How it works...
Submitting an app
Getting ready
How to do it...
How it works...
There's more...
Free app submissions
Getting paid
Download reports
Localization
Index
Windows Phone 7 Silverlight Cookbook
Windows Phone 7 Silverlight Cookbook
Copyright © 2011 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2011
Production Reference: 1180811
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK
ISBN 978-1-849691-16-1
www.packtpub.com
Cover Image by Asher Wishkerman (<wishkerman@hotmail.com>)
Credits
Authors
Jonathan Marbutt
Robb Schiefer Jr.
Reviewers
Cory Smith
Kelum Peiris
Tom McLeod
Acquisition Editors
David Barnes
Steven Wilding
Development Editor
Hithesh Uchil
Technical Editor
Pallavi Kachare
Copy Editor
Leonard D'Silva
Project Coordinator
Zainab Bagasrawala
Proofreader
Aaron Nash
Indexer
Monica Ajmera
Graphics
Geetanjali Sawant
Production Coordinator
Alwin Roy
Cover Work
Alwin Roy
Foreword
I am delighted that Jonathan and Robb undertook the task of writing this book. Both Jonathan and Robb have been involved in the .NET community for a number of years and developed a passion for the Windows Phone. With this book, they have decided to share their knowledge and experience with their readers to help developers dive into doing more with Windows Phone.
When we began rebuilding the Phone, the goal was to do this over multiple releases and keep iterating on feedback rapidly to take the platform forward. In doing so, the platform evolved with the developers consuming it and aligned to their needs. The premise of using platforms like Silverlight and XNA as the basis was founded by the need to make it simple and familiar, and also enable rapid development of a large volume of high quality applications. We also attempted to stitch together the end-to-end story Microsoft had to offer between the tools, the platforms, the phone operating system, and the various services in the company.
When I was approached to write this foreword by Scott Guthrie and Jonathan, I was personally skeptical given the risk of capturing so much in so little. By reading the book, I have personally had a refresher of the various constructs we have enabled over the year and feel that the authors have done a good job telling the end-to-end story.
The book embodies the basic construct of Windows Phone development, namely, to simplify and enable. Jonathan and Robb have taken the essence of what is required to get started and develop applications rapidly which is a key to mobile development. The market continues to evolve rapidly and hence the need for efficient development strategies including quick learning.
I hope the readers of this book learn and are able to develop high quality and attractive applications to help differentiate themselves in the highly competitive market.
Akhil Kaza
Development Manager Silverlight for Windows Phone
About the Authors
Jonathan Marbutt at the early age of ten, began to learn building simple games to amuse his friends and family. Twenty years later, he still has the passion for technology and development. Jonathan loves to share his passion with other developers by writing for his blog and various books as well as speaking at many user groups and technology conferences. Throughout the past three years, Jonathan's focus has primarily been on working with Silverlight and its most recent version for Windows Phone 7. Through this newest version for Windows Phone 7, Jonathan has been able to work on many high profile applications that are rated as some of the most downloaded applications.
Jonathan is also currently the Vice President and Co-founder of WayCool Software, Inc. based in Birmingham, AL which provides solutions for non-profit organizations. Jonathan has also been providing consulting services through his latest venture JM TechWare, Inc. where he helps provide both User Experience and architectural guidance on Silverlight, Windows Phone 7, and WPF applications. In addition to development, Jonathan has co-authored Visual Basic 2010 and .Net 4, published by Wrox Press.
Thank you to my beautiful wife Jennifer for being by my side while writing this book and putting up with the late nights that I worked to get it done. Thank you for supporting me and always being there for me. You are truly the love of my life.
Thank you to my precious little girl, Kathryn, for always brightening my day and making me enjoy the little things in life. Thank you for always making me laugh and always having a smile no matter what is going on. I love you so much and and love getting to be there to watch you grow up.
Thank you to my parents for encouraging me at an early age to pursue my passion and providing me the means to do so. I wouldn't be the person I am today without your help.
Robb Schiefer Jr. is a follower of Christ, husband to the perfect wife, and father of two beautiful girls. Coincidentally, he is also a successful .NET software developer which is a better qualification for writing a programming book.
His development career started while working part-time during college where he learned graphic design basics and built simple data-driven PHP websites. After college, he worked for a small startup on a VB6 application for educators and learned .NET by jumping head first into building a complimentary ASP.NET site. Since then, he has worked as a .NET developer for a market leading, privately held corporation with a global presence. This enterprise environment has provided many unique challenges and learning opportunities. He currently leads a development team in the company's latest development efforts, mentors many developers, and plays a leading role in planning the company's .NET architecture.
Prior to the announcement of Windows Phone 7, he had little experience with Silverlight, but always wanted to learn it. WP7 provided the perfect opportunity to learn Silverlight in a defined space and on a smaller scale. He currently has several apps in the marketplace and has plans for many more (if he ever gets this book done).
I would first like to thank my wonderful wife for her continual support and love (especially while writing the book). Also for her work at home with our two precious girls and in the future, number three. And four? I couldn't ask for a better wife, thank you and I love you. Second I would like to thank Jonathan for his friendship and for asking me to write the book with him. Lastly, thanks to the .NET/Silverlight/Windows Phone development community, Microsoft for finally having a decent smartphone OS which is a joy to work with and the followers of my blog.
About the Reviewers
Tom McLeod started writing software for fun 16 years ago and has been enjoying it ever since. He has written software for HP48 series calculators and a rainbow of UNIX flavors. Since earning a degree in trombone performance, he has worked on a variety of .NET projects. When he's not developing software, he enjoys producing episodes of The Deucecast podcast and being a father and photographer to his two young daughters. He can be contacted through leftylabs.com.
Kelum Peiris is a Mobile Software Developer with Polar Mobile, a company that provides an industry-leading platform to enable top-tier media publishers to easily and quickly launch mobile apps for every major Smartphone. At Polar Mobile, Kelum is primarily involved in developing the Windows Phone platform which will be used to deploy more than 500 apps in year 2011. He is a recent graduate from the University of Waterloo, Ontario, Canada where he specialized in Mobile Development and Real-Time Operating Systems. Kelum has a keen interest in advance concepts in Object Oriented Programming and Design Patterns and he is a clean code addict.
Colin Smith is an experienced mobile developer, musician, and startup guy currently working with a wide range of technologies. He is a co-founder and Mobile Lead of Cardinal, a startup focused on social music sharing, discovery, and analytics. He is currently the Technical Lead / Lead Developer of iOS applications at Shaw Communications as well. You may know him as Smixx, creator of the Developers rap song.
I'd like to thank my lovely wife Chelsea for putting up with the long hours and sleepless nights that went into reviewing this book while getting a startup off the ground and holding down a fulltime job as well, couldn't have done it without you!
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
I would like to dedicate this book to someone who didn't know anything about software development and often called me a nerd. For 23 years she lived life to the fullest and laughed louder than anyone in the world. To my sister Bebe, who went to be with the Lord. I love you.
Robb Schiefer Jr.
Preface
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