Writing Windows 8 Apps with C# and XAML, First Preview Edition

Writing Windows 8 Apps with C# and XAML, First Preview Edition

Programming Windows® SIXTH EDITION Release Preview eBook Writing Windows 8 Apps With C# and XAML Charles Petzold PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2012 Charles Petzold 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. ISBN: 978-0-7356-7176-8 This document supports a preliminary release of a software product that may be changed substantially prior to final commercial release. This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information in this document, including URL and other Internet website references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples 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. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us /IntellectualProperty/Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. 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. Acquisitions, Developmental, and Project Editor: Devon Musgrave Technical Reviewer: Marc Young Cover: Twist Creative • Seattle Introduction ......................................................................................................... 9 The Versions of Windows 8 ....................................................................................................................................................... 9 The Focus of This Book ............................................................................................................................................................. 10 The Approach ............................................................................................................................................................................... 12 My Setup ........................................................................................................................................................................................ 13 The Programming Windows Heritage .................................................................................................................................. 13 Behind the Scenes ....................................................................................................................................................................... 16 Errata & Book Support .............................................................................................................................................................. 17 We Want to Hear from You ..................................................................................................................................................... 17 Stay in Touch ................................................................................................................................................................................ 17 Chapter 1: Markup and Code .......................................................................... 18 The First Project ........................................................................................................................................................................... 18 Graphical Greetings .................................................................................................................................................................... 24 Variations in Text ......................................................................................................................................................................... 28 Media As Well .............................................................................................................................................................................. 36 The Code Alternatives ............................................................................................................................................................... 37 Images in Code ............................................................................................................................................................................ 41 Not Even a Page .......................................................................................................................................................................... 43 Chapter 2: XAML Syntax .................................................................................. 45 The Gradient Brush in Code .................................................................................................................................................... 45 Property Element Syntax .......................................................................................................................................................... 48 Content Properties...................................................................................................................................................................... 51 The TextBlock Content Property............................................................................................................................................. 55 Sharing Brushes (and Other Resources) ............................................................................................................................... 57 Resources Are Shared ................................................................................................................................................................ 61 A Bit of Vector Graphics ............................................................................................................................................................ 62 Stretching with Viewbox ........................................................................................................................................................... 71 Styles ............................................................................................................................................................................................... 74 A Taste of Data Binding ............................................................................................................................................................ 80 3 Chapter 3: Basic Event Handling .................................................................... 83 The Tapped Event ........................................................................................................................................................................ 83 Routed Event Handling ............................................................................................................................................................. 86 Overriding the Handled Setting ............................................................................................................................................. 92 Input, Alignment, and Backgrounds ..................................................................................................................................... 93 Size and Orientation Changes ................................................................................................................................................ 97 Bindings to Run? .......................................................................................................................................................................101 Timers and Animation .............................................................................................................................................................103 Chapter 4: The Border Element ..................................................................... 111 The Border Element ..................................................................................................................................................................111 Rectangle and Ellipse ...............................................................................................................................................................115 The StackPanel ...........................................................................................................................................................................117 Horizontal

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    579 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us