1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft press ebook programming windows phone 7

1K 438 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.013
Dung lượng 13,1 MB

Nội dung

PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2010 by Microsoft Corporation All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2010939982 ISBN: 978-0-7356-4335-2 Printed and bound in the United States of America. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Tell us what you think of this book at http://www.microsoft.com/learning/booksurvey. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademark/EM- US.aspx are trademarks of the Microsoft group of companies. All other marks are the property of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Developmental and Project Editor: Devon Musgrave Editorial Production: Ashley Schneider, S4Carlisle Publishing Services Technical Reviewer: Per Blomqvist; Technical Review Services provided by Content Master, a member of CM Group, Ltd. Cover: Tom Draper Design Body Part No. X17-12906 iii Contents at a Glance Part I The Basics 1 Hello, Windows Phone 7 2 Part II Silverlight 2 Getting Oriented 29 3 An Introduction to Touch . 47 4 Bitmaps, Also Known as Textures . 62 5 Sensors and Services . 80 6 Issues in Application Architecture .103 7 XAML Power and Limitations . 138 8 Elements and Properties . 165 9 The Intricacies of Layout 192 10 The App Bar and Controls 232 11 Dependency Properties .296 12 Data Bindings .338 13 Vector Graphics 393 14 Raster Graphics 461 15 Animations . 508 16 The Two Templates .578 17 Items Controls 641 18 Pivot and Panorama 712 iv Part III XNA 19 Principles of Movement 750 20 Textures and Sprites 775 21 Dynamic Textures 799 22 From Gestures to Transforms 840 23 Touch and Play .900 24 Tilt and Play .952 v Table of Contents Introduction . xii Part I The Basics 1 Hello, Windows Phone 7 . 2 Targeting Windows Phone 7 .2 The Hardware Chassis 4 Sensors and Services 6 File | New | Project .7 A First Silverlight Phone Program 8 The Standard Silverlight Files 10 Color Themes 17 Points and Pixels .18 The XAP is a ZIP 20 An XNA Program for the Phone .21 2 Getting Oriented 29 Silverlight and Dynamic Layout 29 Orientation Events 36 XNA Orientation .38 Simple Clocks (Very Simple Clocks) 41 3 An Introduction to Touch . 47 Low-Level Touch Handling in XNA .47 The XNA Gesture Interface 51 Low-Level Touch Events in Silverlight 52 The Manipulation Events .56 Routed Events .59 Some Odd Behavior? 61 4 Bitmaps, Also Known as Textures 62 XNA Texture Drawing 63 The Silverlight Image Element 65 Images Via the Web .66 Image and ImageSource 70 Loading Local Bitmaps from Code 71 vi Capturing from the Camera 73 The Phone’s Photo Library 76 5 Sensors and Services . 80 Accelerometer .80 A Simple Bubble Level .86 Geographic Location 91 Using a Map Service .95 6 Issues in Application Architecture . 103 Basic Navigation 103 Passing Data to Pages . 110 Sharing Data Among Pages 112 Retaining Data across Instances 117 The Multitasking Ideal 120 Task Switching on the Phone . 120 Page State . 122 Isolated Storage . 126 Xna Tombstoning and Settings 130 Testing and Experimentation . 136 Part II Silverlight 7 XAML Power and Limitations . 138 A TextBlock in Code 139 Property Inheritance . 141 Property-Element Syntax 143 Colors and Brushes 144 Content and Content Properties 151 The Resources Collection 154 Sharing Brushes . 156 x:Key and x:Name 159 An Introduction to Styles 160 Style Inheritance 161 Themes 163 Gradient Accents . 163 8 Elements and Properties . 165 Basic Shapes . 165 vii Transforms . 167 Animating at the Speed of Video 175 Handling Manipulation Events 177 The Border Element . 178 TextBlock Properties and Inlines . 182 More on Images . 185 Playing Movies . 188 Modes of Opacity 188 Non-Tiled Tile Brushes 190 9 The Intricacies of Layout 192 The Single-Cell Grid . 193 The StackPanel Stack 195 Text Concatenation with StackPanel . 199 Nested Panels . 201 Visibility and Layout 202 Two ScrollViewer Applications . 205 The Mechanism of Layout 211 Inside the Panel . 213 A Single-Cell Grid Clone 214 A Custom Vertical StackPanel 218 The Retro Canvas . 220 Canvas and ZIndex 226 The Canvas and Touch 226 The Mighty Grid . 228 10 The App Bar and Controls 232 ApplicationBar Icons . 232 Jot and Application Settings 240 Jot and Touch 245 Jot and the ApplicationBar . 247 Elements and Controls 252 RangeBase and Slider 254 The Basic Button 261 The Concept of Content 265 Theme Styles and Precedence 270 The Button Hierarchy 271 Toggling a Stopwatch . 274 Buttons and Styles . 284 viii TextBox and Keyboard Input . 286 11 Dependency Properties . 296 The Problem Illustrated 296 The Dependency Property Difference . 299 Deriving from UserControl . 310 A New Type of Toggle 321 Panels with Properties 326 Attached Properties 332 12 Data Bindings .338 Source and Target . 338 Target and Mode . 341 Binding Converters 343 Relative Source 348 The “this” Source . 349 Notification Mechanisms 353 A Simple Binding Server . 354 Setting the DataContext . 360 Simple Decision Making . 366 Converters with Properties . 370 Give and Take . 374 TextBox Binding Updates . 380 13 Vector Graphics .393 The Shapes Library 393 Canvas and Grid . 395 Overlapping and ZIndex . 396 Polylines and Custom Curves . 398 Caps, Joins, and Dashes 403 Polygon and Fill . 411 The Stretch Property . 413 Dynamic Polygons . 414 The Path Element 417 Geometries and Transforms . 423 Grouping Geometries 428 The Versatile PathGeometry . 429 The ArcSegment . 431 Bézier Curves 440 ix The Path Markup Syntax 450 How This Chapter Was Created . 455 14 Raster Graphics 461 The Bitmap Class Hierarchy 461 WriteableBitmap and UIElement . 463 The Pixel Bits 470 Vector Graphics on a Bitmap 474 Images and Tombstoning . 480 Saving to the Picture Library 489 Becoming a Photo Extras Application . 497 15 Animations .508 Frame-Based vs. Time-Based 508 Animation Targets . 512 Click and Spin . 513 Some Variations . 516 XAML-Based Animations 520 A Cautionary Tale 523 Key Frame Animations 530 Trigger on Loaded . 534 Animating Attached Properties (or Not) 543 Splines and Key Frames . 548 The Bouncing Ball Problem 557 The Easing Functions . 561 Animating Perspective Transforms . 567 Animations and Property Precedence . 573 16 The Two Templates .578 ContentControl and DataTemplate 578 Examining the Visual Tree 583 ControlTemplate Basics . 589 The Visual State Manager . 601 Sharing and Reusing Styles and Templates 610 Custom Controls in a Library 614 Variations on the Slider 619 The Ever-Handy Thumb 629 Custom Controls 634 x 17 Items Controls 641 Items Controls 641 Items Controls and Visual Trees . 642 Customizing Item Displays . 649 ListBox Selection 653 Binding to ItemsSource . 658 Databases and Business Objects 663 Fun with DataTemplates . 682 Sorting 685 Changing the Panel . 690 The DataTemplate Bar Chart 692 A Card File Metaphor 699 18 Pivot and Panorama 712 Compare and Contrast 712 Music by Composer . 725 The XNA Connection . 728 The XNA Music Classes: MediaLibrary 731 Displaying the Albums 737 The XNA Music Classes: MediaPlayer . 742 Part III XNA 19 Principles of Movement 750 The Naïve Approach 750 A Brief Review of Vectors . 753 Moving Sprites with Vectors 758 Working with Parametric Equations . 760 Fiddling with the Transfer Function 763 Scaling the Text . 764 Two Text Rotation Programs . 768 20 Textures and Sprites 775 The Draw Variants . 775 Another Hello Program? . 777 Driving Around the Block . 782 Movement Along a Polyline . 786 The Elliptical Course 791 A Generalized Curve Solution 794 xi . indexed print editions: Microsoft Silverlight Programming for Windows Phone 7 and Microsoft XNA Framework Programming for Windows Phone 7 . With the money you’ve. applications for Windows Phone 7 using the C# programming language with the Silverlight and XNA 2D frameworks. Yes, Programming Windows Phone 7 is truly a

Ngày đăng: 10/12/2013, 14:20

TỪ KHÓA LIÊN QUAN