Programming Windows®, Six Edition

Book description

Reimagined for full-screen and touch-optimized apps, Windows 8 provides a platform for reaching new users in new ways. In response, programming legend Charles Petzold is rewriting his classic Programming Windows—one of the most popular programming books of all time—to show developers how to use existing skills and tools to build Windows 8 apps.

Programming Windows, Sixth Edition focuses on creating Windows 8 apps accessing the Windows Runtime with XAML and C#. The book also provides C++ code samples. The Sixth Edition is organized in two parts:

  • Part I, “Elementals,” begins with the interrelationship between code and XAML, basic event handling, dynamic layout, controls, templates, asynchronous processing, the application bar, control customization, and collections. You should emerge from Part I ready to create sophisticated page-oriented collection-based user interfaces using the powerful ListView and GridView controls.

  • Part II, “Specialties,” explores topics you might not need for every program but are essential to a well-rounded education in Windows 8. These include multitouch, bitmap graphics, interfacing with share and search facilities, printing, working with the sensors (GPS and orientation), text, obtaining input from the stylus (including handwriting recognition), accessing web services, calling Win32 and DirectX functions, and bringing your application to the Windows 8 app store.

  • Table of contents

    1. Programming Windows®, Six Edition
    2. Introduction
      1. The Versions of Windows 8
      2. The Focus of This Book
      3. The Approach
      4. Source Code
      5. My Setup
      6. The Programming Windows Heritage
      7. More in the Future
      8. Behind the Scenes
      9. Errata & Book Support
      10. We Want to Hear from You
      11. Stay in Touch
    3. I. Elementals
      1. 1. Markup and Code
        1. The First Project
        2. Graphical Greetings
        3. Variations in Text
        4. Media As Well
        5. The Code Alternatives
        6. Images in Code
        7. Not Even a Page
      2. 2. XAML Syntax
        1. The Gradient Brush in Code
        2. Property-Element Syntax
        3. Content Properties
        4. The TextBlock Content Property
        5. Sharing Brushes (and Other Resources)
        6. Resources Are Shared
        7. Exploring Vector Graphics
        8. Stretching with Viewbox
        9. Styles
        10. A Taste of Data Binding
      3. 3. Basic Event Handling
        1. The Tapped Event
        2. Routed Event Handling
        3. Overriding the Handled Setting
        4. Input, Alignment, and Backgrounds
        5. Size and Orientation Changes
        6. Bindings to Run?
        7. Timers and Animation
      4. 4. Presentation with Panels
        1. The Border Element
        2. Rectangle and Ellipse
        3. The StackPanel
        4. Horizontal Stacks
        5. WhatSize with Bindings (and a Converter)
        6. The ScrollViewer Solution
        7. Layout Weirdness or Normalcy?
        8. Making an E-Book
        9. Fancier StackPanel Items
        10. Deriving from UserControl
        11. Creating Windows Runtime Libraries
        12. The Wrap Alternative
        13. The Canvas and Attached Properties
        14. The Z-Index
        15. Canvas Weirdness
      5. 5. Control Interaction
        1. The Control Difference
        2. The Slider for Ranges
        3. The Grid
        4. Orientation and Aspect Ratios
        5. Slider and the Formatted String Converter
        6. Tooltips and Conversions
        7. Sketching with Sliders
        8. The Varieties of Button Experience
        9. Defining Dependency Properties
        10. RadioButton Tags
        11. Keyboard Input and TextBox
        12. Touch and Thumb
      6. 6. WinRT and MVVM
        1. MVVM (Brief and Simplified)
        2. Data Binding Notifications
        3. A View Model for ColorScroll
        4. Syntactic Shortcuts
        5. The DataContext Property
        6. Bindings and TextBox
        7. Buttons and MVVM
        8. The DelegateCommand Class
      7. 7. Asynchronicity
        1. Threads and the User Interface
        2. Working with MessageDialog
        3. Callbacks as Lambda Functions
        4. The Amazing await Operator
        5. Cancelling an Asynchronous Operation
        6. Approaches to File I/O
          1. Application Local Storage
          2. File Pickers
          3. Bulk Access
        7. File Pickers and File I/O
        8. Handling Exceptions
        9. Consolidating Async Calls
        10. Streamlined File I/O
        11. Application Lifecycle Issues
        12. Your Own Asynchronous Methods
      8. 8. App Bars and Popups
        1. Implementing Context Menus
        2. The Popup Dialog
        3. Application Bars
        4. The Application Bar Button Style
        5. Inside the Segoe UI Symbol Font
        6. App Bar CheckBox and RadioButton
        7. An App Bar for a Note Pad
        8. Introducing XamlCruncher
        9. Application Settings and View Models
        10. The XamlCruncher Page
        11. Parsing the XAML
        12. XAML Files In and Out
        13. The Settings Dialog
        14. Beyond the Windows Runtime
      9. 9. Animation
        1. The Windows.UI.Xaml.Media.Animation Namespace
        2. Animation Basics
        3. Animation Variation Appreciation
        4. Other Double Animations
        5. Animating Attached Properties
        6. The Easing Functions
        7. All-XAML Animations
        8. Animating Custom Classes
        9. Key Frame Animations
        10. The Object Animation
        11. Predefined Animations and Transitions
      10. 10. Transforms
        1. A Brief Overview
        2. Rotation (Manual and Animated)
        3. Visual Feedback
        4. Translation
        5. Transform Groups
        6. The Scale Transform
        7. Building an Analog Clock
        8. Skew
        9. Making an Entrance
        10. Transform Mathematics
        11. The Composite Transform
        12. Geometry Transforms
        13. Brush Transforms
        14. Dude, Where’s My Element?
        15. Projection Transforms
        16. Deriving a Matrix3D
      11. 11. The Three Templates
        1. Data in a Button
        2. Making Decisions
        3. Collection Controls and the Real Use of DataTemplate
        4. Collections and Interfaces
        5. Tapping and Selecting
        6. Panels and Virtualizing Panels
        7. Custom Panels
        8. The Item Template Bar Chart
        9. The FlipView Control
        10. The Basic Control Template
        11. The Visual State Manager
        12. Using generic.xaml
        13. Template Parts
        14. Custom Controls
        15. Templates and Item Containers
      12. 12. Pages and Navigation
        1. Screen Resolution Issues
        2. Scaling Issues
        3. Snap Views
        4. Orientation Changes
        5. Simple Page Navigation
        6. The Back Stack
        7. Navigation Events and Page Restoration
        8. Saving and Restoring Application State
        9. Navigational Accelerators and Mouse Buttons
        10. Passing and Returning Data
        11. Visual Studio Standard Templates
        12. View Models and Collections
        13. Grouping the Items
    4. II. Specialties
      1. 13. Touch, Etc.
        1. A Pointer Roadmap
        2. A First Dab at Finger Painting
        3. Capturing the Pointer
        4. Editing with a Popup Menu
        5. Pressure Sensitivity
        6. Smoothing the Tapers
        7. How Do I Save My Drawings?
        8. Real and Surreal Finger Painting
        9. A Touch Piano
        10. Manipulation, Fingers, and Elements
        11. Working with Inertia
        12. An XYSlider Control
        13. Centered Scaling and Rotation
        14. Single-Finger Rotation
      2. 14. Bitmaps
        1. Pixel Bits
        2. Transparency and Premultiplied Alphas
        3. A Radial Gradient Brush
        4. Loading and Saving Image Files
        5. Posterize and Monochromize
        6. Saving Finger Paint Artwork
        7. HSL Color Selection
        8. Reverse Painting
        9. Accessing the Pictures Library
        10. Capturing Camera Photos
      3. 15. Going Native
        1. An Introduction to P/Invoke
        2. Some Help
        3. Time Zone Information
        4. A Windows Runtime Component Wrapper for DirectX
        5. DirectWrite and Fonts
        6. Configurations and Platforms
        7. Interpreting Font Metrics
        8. Drawing on a SurfaceImageSource
      4. 16. Rich Text
        1. Private Fonts
        2. A Taste of Glyphs
        3. Font Files in Local Storage
        4. Typographical Enhancements
        5. RichTextBlock and Paragraphs
        6. RichTextBlock Selection
        7. RichTextBlock and Overflow
        8. The Perils of Pagination
        9. Rich Editing with RichEditBox
        10. Your Own Text Input
      5. 17. Share and Print
        1. Settings and Popups
        2. Sharing Through the Clipboard
        3. The Share Charm
        4. Basic Printing
        5. Printable and Unprintable Margins
        6. The Pagination Process
        7. Custom Printing Properties
        8. Printing a Monthly Planner
        9. Printing a Range of Pages
        10. Where to Do the Big Jobs?
        11. Printing FingerPaint Art
      6. 18. Sensors and GPS
        1. Orientation and Orientation
        2. Acceleration, Force, Gravity, and Vectors
        3. Follow the Rolling Ball
        4. The Two Norths
        5. Inclinometer = Accelerometer + Compass
        6. OrientationSensor = Accelerometer + Compass
        7. Azimuth and Altitude
        8. Bing Maps and Bing Map Tiles
      7. 19. Pen (Also Known as Stylus)
        1. The InkManager Collections
        2. The Ink Drawing Attributes
        3. Erasing and Other Enhancements
        4. Selecting Strokes
        5. The Yellow Pad
    5. Index
    6. About the Author
    7. Copyright

    Product information

    • Title: Programming Windows®, Six Edition
    • Author(s): Charles Petzold
    • Release date: January 2013
    • Publisher(s): Microsoft Press
    • ISBN: 9780735671751