Charles Petzold编写《Windows程序设计》一书已有25年。他曾经获得过Windows Pioneer奖,是经典之作《Windows程序设计》、广受欢迎的《Code: The Hidden Language of Computer Hardware》和《Software, Programming Windows Phone 7》以及其他10余本专著的作者。
目錄:
Contents
PART I ELEMENTALS
Chapter 1 Markup and Code 3
The First Project 3
Graphical Greetings 9
Variations in Text 13
Media As Well 22
The Code Alternatives 23
Images in Code 27
Not Even a Page 29
Chapter 2 XAML Syntax 31
The Gradient Brush in Code 31
Property Element Syntax 34
Content Properties 37
The TextBlock Content Property 41
Sharing Brushes and Other Resources 43
Resources Are Shared 47
Exploring Vector Graphics 48
Stretching with Viewbox 58
Styles 60
A Taste of Data Binding 66
Chapter 3 Basic Event Handling 69
The Tapped Event 69
Routed Event Handling 72
Overriding the Handled Setting 78
Input, Alignment, and Backgrounds 80
Size and Orientation Changes 83
Bindings to Run? 87
Timers and Animation 89
Chapter 4 Presentation with Panels 97
The Border Element 97
Rectangle and Ellipse 101
The StackPanel 103
Horizontal Stacks 106
WhatSize with Bindings and a Converter 108
The ScrollViewer Solution 112
Layout Weirdness or Normalcy? 118
Making an E-Book 119
Fancier StackPanel Items 122
Deriving from UserControl 124
Creating Windows Runtime Libraries 127
The Wrap Alternative 130
The Canvas and Attached Properties 132
The Z-Index 136
Canvas Weirdness 137
Chapter 5 Control Interaction 139
The Control Difference 139
The Slider for Ranges 141
The Grid 146
Orientation and Aspect Ratios 152
Slider and the Formatted String Converter 154
Tooltips and Conversions 154
Sketching with Sliders 157
The Varieties of Button Experience 159
Defi ning Dependency Properties 167
RadioButton Tags 177
Keyboard Input and TextBox 184
Touch and Thumb 187
Chapter 6 WinRT and MVVM 193
MVVM Brief and Simplifi ed 193
Data Binding Notifi cations 194
A View Model for ColorScroll 196
Syntactic Shortcuts 201
The DataContext Property 204
Bindings and TextBox 206
Buttons and MVVM 212
The DelegateCommand Class 213
Chapter 7 Asynchronicity 221
Threads and the User Interface 221
Working with MessageDialog 222
Callbacks as Lambda Functions 228
The Amazing await Operator 229
Cancelling an Asynchronous Operation 231
Approaches to File IO 233
Application Local Storage 234
File Pickers 234
Bulk Access 235
File Pickers and File IO 235
Handling Exceptions 240
Consolidating Async Calls 241
Streamlined File IO 243
Application Lifecycle Issues 245
Your Own Asynchronous Methods 250
Chapter 8 App Bars and Popups 261
Implementing Context Menus 261
The Popup Dialog 265
Application Bars 268
The Application Bar Button Style 271
Inside the Segoe UI Symbol Font 276
App Bar CheckBox and RadioButton 283
An App Bar for a Note Pad 286
Introducing XamlCruncher 293
Application Settings and View Models 308
The XamlCruncher Page 311
Parsing the XAML 316
XAML Files In and Out 318
The Settings Dialog 322
Beyond the Windows Runtime 327
Chapter 9 Animation 329
The Windows.UI.Xaml.Media.Animation Namespace 329
Animation Basics 330
Animation Variation Appreciation 334
Other Double Animations 340
Animating Attached Properties 347
The Easing Functions 350
All-XAML Animations 359
Animating Custom Classes 364
Key Frame Animations 367
The Object Animation 371
Predefi ned Animations and Transitions 373
Chapter 10 Transforms 377
A Brief Overview 377
Rotation Manual and Animated 380
Visual Feedback 386
Translation 388
Transform Groups 391
The Scale Transform 396
Building an Analog Clock 400
Skew 406
Making an Entrance 409
Transform Mathematics 410
The CompositeTransform 418
Geometry Transforms 421
Brush Transforms 422
Dude, Where’s My Element? 427
Projection Transforms 430
Deriving a Matrix3D 437
Chapter 11 The Three Templates 449
Data in a Button 450
Making Decisions 460
Collection Controls and the Real Use of DataTemplate 463
Collections and Interfaces 474
Tapping and Selecting 475
Panels and Virtualizing Panels 481
Custom Panels 484
The Item Template Bar Chart 497
The FlipView Control 500
The Basic Control Template 502
The Visual State Manager 513
Using generic.xaml 520
Template Parts 521
Custom Controls 530
Templates and Item Containers 535
Chapter 12 Pages and Navigation 539
Screen Resolution Issues 539
Scaling Issues 545
Snap Views 549
Orientation Changes 554
Simple Page Navigation 557
The Back Stack 562
Navigation Events and Page Restoration 564
Saving and Restoring Application State 568
Navigational Accelerators and Mouse Buttons 572
Passing and Returning Data 575
Visual Studio’s Standard Templates 581
View Models and Collections 588
Grouping the Items 608
PART II SPECIALTIES
Chapter 13 Touch, Etc. 615
A Pointer Roadmap 616
A First Dab at Finger Painting 619
Capturing the Pointer 622
Editing with a Popup Menu 630
Pressure Sensitivity 633
Smoothing the Tapers 637
How Do I Save My Drawings? 646
Real and Surreal Finger Painting 647
A Touch Piano 649
Manipulation, Fingers, and Elements 655
Working with Inertia 663
An XYSlider Control 667
Centered Scaling and Rotation 673
Single-Finger Rotation 676
Chapter 14 Bitmaps 683
Pixel Bits 684
Transparency and Premultiplied Alphas 691
A Radial Gradient Brush 696
Loading and Saving Image Files 703
Posterize and Monochromize 714
Saving Finger Paint Artwork 722
HSL Color Selection 747
Reverse Painting 758
Accessing the Pictures Library 763
Capturing Camera Photos 772
Chapter 15 Going Native 779
An Introduction to PInvoke 780
Some Help 786
Time Zone Information 786
A Windows Runtime Component Wrapper for DirectX 808
DirectWrite and Fonts 809
Confi gurations and Platforms 821
Interpreting Font Metrics 824
Drawing on a SurfaceImageSource 831
Chapter 16 Rich Text 845
Private Fonts 847
A Taste of Glyphs 850
Font Files in Local Storage 852
Typographical Enhancements 856
RichTextBlock and Paragraphs 858
RichTextBlock Selection 862
RichTextBlock and Overfl ow 862
The Perils of Pagination 870
Rich Editing with RichEditBox 877
Your Own Text Input 886
Chapter 17 Share and Print 893
Settings and Popups 894
Sharing Through the Clipboard 898
The Share Charm 903
Basic Printing 904
Printable and Unprintable Margins 911
The Pagination Process 915
Custom Printing Properties 922
Printing a Monthly Planner 928
Printing a Range of Pages 937
Where To Do the Big Jobs? 948
Printing FingerPaint Art 948
Chapter 18 Sensors and GPS 953
Orientation and Orientation 953
Acceleration, Force, Gravity, and Vectors 958
Follow the Rolling Ball 969
The Two Norths 973
Inclinometer = Accelerometer + Compass 976
OrientationSensor = Accelerometer + Compass 980
Azimuth and Altitude 986
Bing Maps and Bing Map Tiles 999
Chapter 19 Pen Also Known as Stylus 1013
The InkManager Collections 1014
The Ink Drawing Attributes 1017
Erasing and Other Enhancements 1023
Selecting Strokes 1029
The Yellow Pad 1038
Index 1057