HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Full Color: Figures and code appear as they do in Visual Studio.
Universal Windows apps are a total game-changer. You can now write once and deploy your app to any modern PC, tablet, phone, or other Windows device. Suddenly, it’s quick and easy to serve new devices and form factors, sharing unified assets ranging from code to styles to user controls. It has never been easier to reach multiple-device markets!
Now, the world’s #1 expert on Microsoft XAML brings together all the knowledge Windows developers need to build universal apps that adapt smoothly for any device running Windows 8.1, Windows Phone 8.1, or their successors. Drawing on his unsurpassed personal experience and direct input from Microsoft’s Windows and Visual Studio teams, Adam Nathan illuminates core development concepts, answers your most important questions, and candidly assesses the technology’s strengths and limitations.
This full-color guide walks you through every key task involved in building a universal Windows app: layout and input, working with the app model, using advanced controls, leveraging XAML’s powerful rich media features, and much more.
Detailed information on how to...
Please download the code files associated with Universal Windows Apps with XAML and C# Unleashed here.
Universal Windows Apps with XAML and C# Unleashed: Threading, Windows, and Pages
Download the sample pages (includes Chapter 7 and Index)
Introduction 1
Who Should Read This Book? 3
Software Requirements 3
Code Examples 3
How This Book Is Organized 3
Conventions Used in This Book 5
Part I: Getting Started
Chapter 1: Hello, Real World! 7
Creating, Deploying, and
Profiling an App 7
Understanding the App
Packages 10
Updating XAML and C# Code 21
Making the App World-Ready 29
Making the App Accessible 35
Submitting to the Windows Store 40
Summary 42
Chapter 2: Mastering XAML 43
Elements and Attributes 44
Namespaces 45
Property Elements 47
Type Converters 49
Markup Extensions 49
Children of Object Elements 52
Mixing XAML with C# 56
XAML Keywords 59
Summary 60
Part II: Building an App
Chapter 3: Sizing, Positioning, and Transforming Elements 63
Controlling Size 64
Controlling Position 68
Applying 2D Transforms 72
Applying 3D Transforms 79
Summary 82
Chapter 4: Layout 83
Discovering Your Window Size and Location 84
Panels 88
Handling Content Overflow 103
Summary 115
Chapter 5: Handling Input: Touch, Mouse, Pen, and Keyboard 117
Touch Input 118
Mouse Input 141
Pen Input 144
Keyboard Input 153
Summary 159
Part III: Working with the App Model
Chapter 6: App Lifecycle 161
Killing 163
Suspending 164
Resuming 166
Terminating 167
Launching 168
Activating 171
Managing Session State with SuspensionManager 173
Programmatically Launching Apps 176
Summary 179
Chapter 7: Threading, Windows, and Pages 181
Understanding the Threading Model for Universal Apps 181
Displaying Multiple Windows 186
Navigating Between Pages 189
Summary 198
Chapter 8: The Many Ways to Earn Money 199
Adding Advertisements to Your App 200
Supporting a Free Trial 205
Supporting In-App Purchases 210
Validating Windows Store Receipts 218
Testing Windows Store
Features 220
Summary 225
Part IV: Understanding Controls
Chapter 9: Content Controls 227
Button 230
AppBarButton 234
HyperlinkButton 241
RepeatButton 242
ToggleButton 243
AppBarToggleButton 243
CheckBox 244
RadioButton 245
ToolTip 246
App Bars 249
Summary 257
Chapter 10: Items Controls 259
Items in the Control 260
Items Panels 262
ComboBox 265
ListBox 267
ListView 269
GridView 273
FlipView 274
SemanticZoom 276
MenuFlyout 279
Summary 281
Chapter 11: Text 283
TextBlock 283
RichTextBlock 296
TextBox 301
RichEditBox 309
PasswordBox 311
Summary 313
Chapter 12: Images 315
The Image Element 316
Multiple Files for Multiple
Environments 325
Decoding Images 330
Encoding Images 339
Rendering PDF Content as an Image 347
Summary 353
Chapter 13: Audio, Video, and Speech 355
Playback 356
Capture 367
Transcoding 378
Speech Synthesis 383
Summary 386
Chapter 14: Other Controls 387
Range Controls 387
SearchBox 390
Popup Controls 397
Hub 403
Date and Time Controls 407
ProgressRing 411
ToggleSwitch 412
WebView 413
Summary 419
Part V: Leveraging the Richness of XAML
Chapter 15: Vector Graphics 421
Shapes 421
Geometries 428
Brushes 436
Summary 450
Chapter 16: Animation 453
Dependency Properties 454
Theme Transitions 455
Theme Animations 466
Custom Animations 472
Custom Keyframe Animations 485
Easing Functions 490
Manual Animations 495
Summary 497
Chapter 17: Styles, Templates, and Visual States 499
Styles 500
Templates 509
Visual States 519
Summary 528
Chapter 18: Data Binding 529
Introducing Binding 529
Controlling Rendering 538
Customizing the View of a Collection 546
High-Performance Rendering with ListView and GridView 550
Summary 554
Part VI: Exploiting Windows
Chapter 19: Working with Data 555
An Overview of Files and Folders 555
App Data 557
User Data 563
Networking 572
Summary 582
Chapter 20: Supporting App Commands 583
Search 584
Share 589
Print 596
Play 604
Project 606
Settings 606
Summary 611
Chapter 21: Leveraging Contracts 613
Account Picture Provider 615
AutoPlay Content and
AutoPlay Device 617
File Type Associations 620
Protocol 623
File Open Picker 624
File Save Picker 627
Contact Picker 628
The Contact Contract 631
The Appointments Provider
Contract 635
Background Tasks 637
Summary 646
Chapter 22: Reading from Sensors 647
Accelerometer 647
Gyrometer 651
Inclinometer 651
Compass 651
Light Sensor 651
Orientation 652
Location 652
Proximity 659
Summary 662
Chapter 23: Controlling Devices 663
Fingerprint Readers 664
Image Scanners 664
Barcode Scanners 668
Magnetic Stripe Readers 671
Custom Bluetooth Devices 673
Custom Bluetooth Smart
Devices 676
Custom USB Devices 679
Custom HID Devices 682
Custom Wi-Fi Direct Devices 684
Summary 686
Chapter 24: Thinking Outside the App: Live Tiles, Notifications, and the Lock Screen 687
Live Tiles 687
Badges 701
Secondary Tiles 703
Toast Notifications 705
Setting Up Push Notifications 711
The Lock Screen 719
Summary 721
Index 723