800 East 96th Street, Indianapolis, Indiana 46240 USA
Adam Nathan
101 Windows
®
Phone 7 Apps,
VOLUME I: DEVELOPING APPS 1-50
101 Windows® Phone 7 Apps,Volume I
Copyright © 2011 by Adam Nathan
All rights reserved. No part of this book shall be reproduced, stored in a retrieval
system, or transmitted by any means, electronic, mechanical, photocopying, record-
ing, 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-33552-5
ISBN-10: 0-672-33552-2
Library of Congress Cataloging-in-Publication Data
Nathan, Adam, 1977-
101 Windows phone 7 apps / Adam Nathan.
v. cm.
Includes index.
Contents: v. 1. Developing apps 1-50.
ISBN-13: 978-0-672-33552-5 (v. 1)
ISBN-10: 0-672-33119-5 (v. 1)
1. Application software—Development. 2. Windows phone (Computer file) 3.
Smartphones—Programming. 4. Mobile computing. I.Title. II. Title: One hundred one
Windows phone 7 apps.
QA76.76.A65N378 2011
004.165—dc22
2011010335
Printed in the United States of America
First Printing April 2011
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 possi-
ble, but no warranty or fitness is implied.The information provided is on an “as is”
basis.The author(s) 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 or from the use of the programs accompanying it.
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
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact
International Sales
international@pearsoned.com
EDITOR-IN-CHIEF
Greg Wiegand
EXECUTIVE EDITOR
Neil Rowe
DEVELOPMENT EDITOR
Mark Renfrow
MANAGING EDITOR
Kristy Hart
PROJECT EDITOR
Betsy Harris
SENIOR INDEXER
Cheryl Lenser
PROOFREADER
Apostrophe Editing
Services
TECHNICAL EDITOR
Dave Relyea
PUBLISHING
COORDINATOR
Cindy Teeters
BOOK DESIGNERS
Gary Adair
Adam Nathan
COMPOSITOR
Bronkella Publishing LLC
Introduction 1
part I getting started
1 Tally (App Basics) 17
2 Flashlight (Application Bar) 39
3 In Case of Emergency (Orientation & Keyboards) 61
4 Stopwatch (Grid & User Controls) 89
5 Ruler (Canvas & Vector Graphics) 123
6 Baby Sign Language (Page Navigation & Data Binding) 153
7 Date Diff (Silverlight for Windows Phone Toolkit) 185
8 Vibration Composer (Vibration & Running While Locked) 191
9 Fake Call (Resources & Styles) 207
10 Tip Calculator (Application Lifecycle & Control Templates) 235
11 XAML Editor (Dynamic XAML & Popup) 271
part II transforms & animations
12 Silly Eye (Intro to Animation) 301
13 Metronome (Intro to 2D Transforms) 327
14 Love Meter (Keyframe Animations) 347
15 Mood Ring (Color, Object & Point Animations) 361
16 Lottery Numbers Picker (Sharing Animations) 377
17 Pick a Card Magic Trick (3D Transforms) 395
18 Cocktails (Quick Jump Grid) 413
19 Animation Lab (Custom Controls & VSM) 441
contents at a glance
part III storing & retrieving local data
20 Alarm Clock (Settings,Toggle Switch, Custom Font) 463
21 Passwords & Secrets (Encryption & Observable Collections) 493
22 Notepad (Reading & Writing Files) 527
23 Baby Milestones (Reading & Writing Pictures) 545
24 Baby Name Eliminator (Local Databases & Embedded Resources) 565
25 Book Reader (Pagination & List Picker) 587
part IV pivot, panorama, charts, & graphs
26 TODO List (Pivot & Context Menu) 611
27 Groceries (Panorama) 649
28 Alphabet Flashcards (Filmstrip-Style Swiping) 675
29 Weight Tracker (Charts & Graphs) 681
part V audio & video
30 Cowbell (Sound Effects) 711
31 Trombone (Sound Manipulation) 719
32 Local FM Radio (Radio Tuner) 731
33 Subservient Cat (Video) 743
part VI microphone
34 Bubble Blower (Sound Detection) 759
35 Talking Parrot (Recording & Playing) 775
36 Sound Recorder (Saving Audio Files & Playing Sound Backward) 797
Contents at a Glance
iv