ebook img

Windows Store App Development: C# and XAML PDF

624 Pages·2013·36.04 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Windows Store App Development: C# and XAML

C# and XAML Pete Brown M A N N I N G Windows Store App Development ii Windows Store App Development C# AND XAML PETE BROWN MANNING SHELTER ISLAND For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email: [email protected] ©2013 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without elemental chlorine. Development editor: Jeff Bleiel Manning Publications Co. Copyeditor: Linda Recktenwald 20 Baldwin Road Technical proofreader: Thomas McKearney PO Box 261 Proofreader: Elizabeth Martin Shelter Island, NY 11964 Typesetter: Marija Tudor Cover designer: Marija Tudor ISBN: 9781617290947 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 18 17 16 15 14 13 brief contents 1 ■ Hello, Modern Windows 1 2 ■ The Modern UI 19 3 ■ The Windows Runtime and .NET 35 4 ■ XAML 51 5 ■ Layout 69 6 ■ Panels 86 7 ■ Brushes, graphics, styles, and resources 112 8 ■ Displaying beautiful text 141 9 ■ Controls, binding, and MVVM 170 10 ■ View controls, Semantic Zoom, and navigation 211 11 ■ The app bar 241 12 ■ The splash screen, app tile, and notifications 265 13 ■ View states 300 14 ■ Contracts: playing nicely with others 319 15 ■ Working with files 342 16 ■ Asynchronous everywhere 369 17 ■ Networking with SOAP and RESTful services 388 v vi BRIEF CONTENTS 18 ■ A chat app using sockets 423 19 ■ A little UI work: user controls and Blend 465 20 ■ Networking player location 482 21 ■ Keyboards, mice, touch, accelerometers, and gamepads 500 22 ■ App settings and suspend/resume 537 23 ■ Deploying and selling your app 559 contents preface xvii acknowledgments xx about this book xxii about the author xxviii about the cover illustration xxix 1 Hello, Modern Windows 1 1.1 Setting up the development environment 3 1.2 Configuring the project 3 The device pane 5 ■ Template solution items 7 1.3 Create the first Hello World UI 8 1.4 Integrating with Twitter 9 The Tweet class 10 ■ Updated UI 10 ■ Code-behind 11 1.5 Testing on different devices and resolutions 13 Debugging on the Simulator 13 ■ Debugging on a remote device 14 1.6 Summary 18 2 The Modern UI 19 2.1 Design inspiration 20 Direct influences 21 ■ Finding your way 22 vii viii CONTENTS 2.2 Governing principles 23 2.3 Typography 25 2.4 The importance of the layout grid 27 2.5 Design for touch but not only for touch 28 2.6 Modern apps on Windows 8 28 Consumer and enterprise apps 29 ■ Key Windows 8 UI elements and states 31 2.7 Device considerations 33 Desktop or laptop 33 ■ Tablet and smaller devices 33 Hybrid devices 34 2.8 Summary 34 3 The Windows Runtime and .NET 35 3.1 Windows Store app system architecture 36 The sandbox 38 ■ Deployment and the Windows Store 39 The driver model 40 3.2 COM + .NET metadata = WinRT 41 COM: back to the future 42 ■ Metadata 44 Projections 46 3.3 Client technologies and languages 47 3.4 A brief tour of WinRT and .NET 4.5 48 3.5 Summary 50 4 XAML 51 4.1 Elements and namespaces 52 Objects as elements 52 ■ Namespaces 54 4.2 Properties 56 Property syntax 56 ■ Dependency properties 58 Attached properties 61 ■ Property paths 62 4.3 Object trees and namescope 62 Object trees 63 ■ Namescope 66 4.4 Summary 68 5 Layout 69 5.1 Multipass layout—measuring and arranging 70 The measure pass 71 ■ The arrange pass 71 The LayoutInformation class 73 CONTENTS ix 5.2 UIElement layout properties 74 Width and Height, plus ActualWidth and ActualHeight 75 Horizontal and vertical alignment 77 ■ Padding 78 Margins 79 5.3 Layout rounding 80 5.4 Performance considerations 82 Keeping the tree shallow 82 ■ Caching 83 Virtualization 83 ■ Sizing and positioning 84 5.5 Summary 84 6 Panels 86 6.1 Canvas 87 Positioning in X,Y space 88 ■ Controlling the Z position using ZIndex 89 ■ Sizing child elements 91 6.2 StackPanel and VirtualizingStackPanel 91 Setting the orientation 92 ■ Sizing children 93 Virtualizing for performance 93 6.3 Grid 94 Defining rows and columns 95 ■ Adding and positioning elements in rows and columns 97 ■ Using alignment and margins for sizing and positioning 99 6.4 Creating a custom panel 102 Project setup 102 ■ The OrbitPanel class 103 ■ Orbits dependency property 103 ■ Orbit attached property 105 Custom layout 107 6.5 Summary 111 7 Brushes, graphics, styles, and resources 112 7.1 Brushes 113 Solid-color brushes 113 ■ Gradient brushes 116 Image brushes 118 7.2 Resources 120 Local and page resources 121 ■ Application resources 123 Resource dictionaries 123 7.3 Styles 127 Explicit or keyed styles 127 ■ Style inheritance 128 Implicit styles 130

Description:
SummaryWindows Store App Development introduces C# developers to working with Windows Store apps. It provides full coverage of XAML, and addresses both app design and development. Following numerous carefully crafted examples, you'll learn about new Windows 8 features, the WinRT API, and .NET 4.5. A
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.