SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. 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.
The #1 WPF Book--Now Updated for WPF 4.5!
Thorough, authoritative coverage, practical examples, clear writing, and full-color presentation make this one of the most widely acclaimed programming books of the last decade.
Windows Presentation Foundation (WPF) is the recommended technology for creating modern Windows desktop apps. Whether you want to develop traditional user interfaces or integrate 3D graphics, audio/video, animation, dynamic skinning, touch, rich document support, speech recognition, or more, WPF enables you to do so in a seamless, resolution-independent manner that scales from small tablets to large TVs. WPF 4.5 Unleashed is the authoritative book that covers it all, in a practical and approachable fashion, authored by WPF guru and Microsoft architect Adam Nathan.
Introduction 1
Who Should Read This Book? 2
Software Requirements 3
Code Examples 3
How This Book Is Organized 4
Conventions Used in This Book 6
Part I: Background
Chapter 1: Why WPF? 7
A Look at the Past 8
Enter WPF 9
The Evolution of WPF 12
Summary 16
Chapter 2: XAML Demystified 17
XAML Defined 19
Elements and Attributes 20
Namespaces 22
Property Elements 25
Type Converters 26
Markup Extensions 28
Children of Object Elements 31
Mixing XAML with Procedural Code 36
XAML2009 44
XAML Keywords 49
Summary 52
Chapter 3: WPF Fundamentals 55
A Tour of the Class Hierarchy 55
Logical and Visual Trees 57
Dependency Properties 62
Summary 76
Part II: Building a WPF Application
Chapter 4: Sizing, Positioning, and Transforming Elements 77
Controlling Size 78
Controlling Position 83
Applying Transforms 86
Summary 95
Chapter 5: Layout with Panels 97
Canvas 98
StackPanel 100
WrapPanel 102
DockPanel 105
Grid 108
Primitive Panels 120
Handling Content Overflow 122
Putting It All Together: Creating a Visual Studio-Like Collapsible, Dockable, Resizable Pane 130
Summary 140
Chapter 6: Input Events: Keyboard, Mouse, Stylus, and Touch 141
Routed Events 141
Keyboard Events 150
Mouse Events 152
Stylus Events 156
Touch Events 158
Commands 170
Summary 176
Chapter 7: Structuring and Deploying an Application 177
Standard Desktop Applications 177
Navigation-Based Desktop Applications 193
Gadget-Style Applications 205
XAML Browser Applications 207
Loose XAML Pages 213
Summary 215
Chapter 8: Exploiting Windows Desktop Features 217
Jump Lists 217
Taskbar Item Customizations 229
Aero Glass 233
TaskDialog 236
Summary 239
Part III: Controls
Chapter 9: Content Controls 241
Buttons 243
Simple Containers 248
Containers with Headers 252
Summary 254
Chapter 10: Items Controls 255
Common Functionality 256
Selectors 261
Menus 298
Other Items Controls 302
Summary 308
Chapter 11: Images, Text, and Other Controls 309
The Image Control 309
Text and Ink Controls 311
Documents 318
Range Controls 334
Calendar Controls 336
Summary 340
Part IV: Features for Professional Developers
Chapter 12: Resources 341
Binary Resources 341
Logical Resources 349
Summary 360
Chapter 13: Data Binding 361
Introducing the Binding Object 361
Controlling Rendering 373
Customizing the View of a Collection 385
Data Providers 396
Advanced Topics 403
Putting It All Together: The Pure-XAML Twitter Client 412
Summary 414
Chapter 14: Styles, Templates, Skins, and Themes 415
Styles 416
Templates 430
Skins 458
Themes 465
Summary 470
Part V: Rich Media
Chapter 15: 2D Graphics 473
Drawings 474
Visuals 491
Shapes 503
Brushes 511
Effects 527
Improving Rendering Performance 530
Summary 533
Chapter 16: 3D Graphics 535
Getting Started with 3D Graphics 536
Cameras and Coordinate Systems 540
Transform3D 552
Model3D 561
Visual3D 584
Viewport3D 591
2D and 3D Coordinate System Transformation 594
Summary 603
Chapter 17: Animation 605
Animations in Procedural Code 606
Animations in XAML 619
Keyframe Animations 628
Easing Functions 635
Animations and the Visual State Manager 641
Summary 649
Chapter 18: Audio, Video, and Speech 651
Audio 651
Video 656
Speech 662
Summary 669
Part VI: Advanced Topics
Chapter 19: Interoperability with Non-WPF Technologies 671
Embedding Win32 Controls in WPF Applications 673
Embedding WPF Controls in Win32 Applications 688
Embedding Windows Forms Controls in WPF Applications 695
Embedding WPF Controls in Windows Forms Applications 700
Mixing DirectX Content with WPF Content 704
Embedding ActiveX Controls in WPF Applications 710
Summary 714
Chapter 20: User Controls and Custom Controls 717
Creating a User Control 719
Creating a Custom Control 728
Summary 746
Chapter 21: Layout with Custom Panels 747
Communication Between Parents and Children 748
Creating a SimpleCanvas 751
Creating a SimpleStackPanel 756
Creating an OverlapPanel 759
Creating a FanCanvas 764
Summary 769
Chapter 22: Toast Notifications 771
Prerequisites 771
Sending a Toast Notification 774
Toast Templates 775
Notification Events 778
Scheduled Notifications 779
Summary 780
Appendix A: Fun with XAML Readers and Writers 783
Overview 783
The Node Loop 786
Reading XAML 787
Writing to Live Objects 791
Writing to XML 793
XamlServices 794
Index 799