Introduction 1
Part I: Getting Started
Chapter 1: Hello, Real World! 9
Creating, Deploying, and Profiling an App 9
Understanding the App Package 12
Updating XAML and C# Code 22
Making the App World-Ready 30
Making the App Accessible 36
Submitting to the Windows Store 40
Summary 42
Chapter 2: Mastering XAML 43
Elements and Attributes 44
Namespaces 45
Property Elements 47
Type Converters 48
Markup Extensions 49
Children of Object Elements 51
Mixing XAML with Procedural Code 56
XAML Keywords 59
Summary 61
Part II: Building an App
Chapter 3: Sizing, Positioning, and Transforming Elements 63
Controlling Size 64
Controlling Position 68
Applying 2D Transforms 71
Applying 3D Transforms 79
Summary 82
Chapter 4: Layout 83
Discovering Your Window Size and Location 84
Panels 89
Handling Content Overflow 105
Summary 116
Chapter 5: Interactivity 117
Dependency Properties 117
Routed Events 124
Commands 129
Summary 131
Chapter 6: Handling Input: Touch, Mouse, Pen, and Keyboard 133
Touch Input 134
Mouse Input 156
Pen Input 159
Keyboard Input 168
Summary 174
Part III: Working with the App Model
Chapter 7: App Lifecycle 175
Killing 177
Suspending 178
Resuming 181
Terminating 181
Launching 182
Activating 185
Managing Session State with SuspensionManager 187
Programmatically Launching Apps 190
Summary 193
Chapter 8: Threading, Windows, and Pages 195
Understanding the Threading Model for Windows Store Apps 195
Displaying Multiple Windows 200
Navigating Between Pages 204
Summary 211
Chapter 9: The Many Ways to Earn Money 213
Adding Advertisements to Your App 214
Supporting a Free Trial 220
Supporting In-App Purchases 224
Validating Windows Store Receipts 232
Testing Windows Store Features 235
Summary 240
Part IV: Understanding Controls
Chapter 10: Content Controls 241
Button 244
AppBarButton 247
HyperlinkButton 254
RepeatButton 256
ToggleButton 256
AppBarToggleButton 256
CheckBox 257
RadioButton 258
ToolTip 259
App Bars 262
Summary 269
Chapter 11: Items Controls 271
Items in the Control 272
Items Panels 274
ComboBox 277
ListBox 279
ListView 281
GridView 285
FlipView 287
SemanticZoom 289
MenuFlyout 292
Summary 293
Chapter 12: Text 295
TextBlock 295
RichTextBlock 308
TextBox 313
RichEditBox 321
PasswordBox 324
Summary 326
Chapter 13: Images 327
The Image Element 328
Multiple Files for Multiple Environments 337
Decoding Images 342
Encoding Images 351
Rendering PDF Content as an Image 359
Summary 365
Chapter 14: Audio, Video, and Speech 367
Playback 368
Capture 380
Transcoding 392
Speech Synthesis 397
Summary 399
Chapter 15: Other Controls 401
Range Controls 401
SearchBox 404
Popup Controls 411
Hub 421
Date and Time Controls 426
ProgressRing 429
ToggleSwitch 429
WebView 430
Summary 436
Part V: Leveraging the Richness of XAML
Chapter 16: Vector Graphics 437
Shapes 438
Geometries 444
Brushes 452
Summary 466
Chapter 17: Animation 469
Theme Transitions 470
Theme Animations 481
Custom Animations 486
Custom Keyframe Animations 500
Easing Functions 505
Manual Animations 509
Summary 511
Chapter 18: Styles, Templates, and Visual States 513
Styles 514
Templates 524
Visual States 533
Summary 543
Chapter 19: Data Binding 545
Introducing Binding 545
Controlling Rendering 554
Customizing the View of a Collection 562
High-Performance Rendering with ListView and GridView 566
Summary 569
Part VI: Exploiting Windows 8.1
Chapter 20: Working with Data 571
An Overview of Files and Folders 571
App Data 573
User Data 579
Networking 584
Summary 595
Chapter 21: Supporting Charms 597
The Search Charm 597
The Share Charm 603
The Devices Charm 611
The Settings Charm 620
Summary 625
Chapter 22: Leveraging Contracts 627
Account Picture Provider 629
AutoPlay Content and
AutoPlay Device 631
File Type Associations 634
Protocol 636
File Open Picker 637
File Save Picker 641
Contact Picker 642
The New Contact Contract 644
The New Appointments Provider Contract 648
Background Tasks 650
Summary 659
Chapter 23: Reading from Sensors 661
Accelerometer 661
Gyrometer 665
Inclinometer 665
Compass 665
Light Sensor 665
Orientation 666
Location 666
Proximity 674
Summary 677
Chapter 24: Controlling Devices 679
Fingerprint Readers 679
Image Scanners 680
Barcode Scanners 684
Magnetic Stripe Readers 687
Custom Bluetooth Devices 689
Custom Bluetooth Smart Devices 692
Custom USB Devices 695
Custom HID Devices 698
Custom Wi-Fi Direct Devices 700
Summary 702
Chapter 25: Thinking Outside the App: Live Tiles, Notifications, and the Lock Screen 703
Live Tiles 703
Badges 718
Secondary Tiles 720
Toast Notifications 722
Setting Up Push Notifications 728
The Lock Screen 736
Summary 738
Part VII: Advanced Features
Chapter 26: Integrating DirectX 739
Integrating as an Image Source 740
Integrating the Swap Chain 747
Summary 752
Chapter 27: Custom Controls and Components 755
Creating a User Control 756
Creating a More Complex
Control 759
Creating a Templated Control 771
Creating a Windows Runtime Component 776
Summary 779
Chapter 28: Layout with Custom Panels 781
Communication Between Parents and Children 782
Creating a SimpleCanvas 785
Creating a SimpleStackPanel 789
Creating a UniformGrid 792
Summary 798
Index 799