Sold out

WPF 4 Unleashed

English · Paperback / Softback

Description

Read more

The #1 WPF Book--Now Updated for WPF 4!

Full Color: Code samples appear as they do in Visual Studio!

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 Windows user interfaces, giving you the power to create richer and more compelling applications than you dreamed possible. Whether you want to develop traditional user interfaces or integrate 3D graphics, audio/video, animation, dynamic skinning, multi-touch, rich document support, speech recognition, or more, WPF enables you to do so in a seamless, resolution-independent manner. WPF 4 Unleashed is the authoritative book that covers it all, in a practical and approachable fashion, authored by WPF guru and Microsoft developer Adam Nathan.

Covers everything you need to know about Extensible Application Markup Language (XAML)
Examines the WPF feature areas in incredible depth: controls, layout, resources, data binding, styling, graphics, animation, and more
Highlights the latest features, such as multi-touch, text rendering improvements, XAML language enhancements, new controls, the Visual State Manager, easing functions, and much more
Delves into topics that aren

List of contents

Introduction     1
Who Should Read This Book?      2
Software Requirements     3
Code Examples     4
How This Book Is Organized     4
Part I: Background     4
Part II: Building a WPF Application     4
Part III: Controls     5
Part IV: Features for Professional Developers     5
Part V: Rich Media     5
Part VI: Advanced Topics     6
Conventions Used in This Book     6
 
Part I Background
Chapter 1: Why WPF, and What About Silverlight?      9
A Look at the Past      10
Enter WPF     11
The Evolution of WPF     14
Enhancements in WPF 3.5 and WPF 3.5 SP1     15
Enhancements in WPF 4     16
What About Silverlight?      18
Summary     19
 
Chapter 2: XAML Demystified     21
XAML Defined     23
Elements and Attributes     24
Namespaces      26
Property Elements     29
Type Converters     30
Markup Extensions     32
Children of Object Elements .      35
The Content Property     35
Collection Items     36
More Type Conversion     38
Mixing XAML with Procedural Code     40
Loading and Parsing XAML at Runtime     40
Compiling XAML     43
Introducing XAML2009     48
Full Generics Support     49
Dictionary Keys of Any Type     50
Built-In System Data Types     50
Instantiating Objects with Non-Default Constructors     51
Getting Instances via Factory Methods     51
Event Handler Flexibility     52
Defining New Properties     53
Fun with XAML Readers and Writers     53
Overview     53
The Node Loop     56
Reading XAML     57
Writing to Live Objects      61
Writing to XML     63
XamlServices     64
XAML Keywords     67
Summary     70
Complaint 1: XML Is Too Verbose to Type     71
Complaint 2: XML-Based Systems Have Poor Performance     71
 
Chapter 3: WPF Fundamentals     73
A Tour of the Class Hierarchy     73
Logical and Visual Trees     75
Dependency Properties     80
A Dependency Property Implementation     81
Change Notification     83
Property Value Inheritance     85
Support for Multiple Providers     87
Attached Properties     89
Summary     93
 
Part II Building a WPF Application
Chapter 4: Sizing, Positioning, and Transforming Elements     97
Controlling Size     98
Height and Width     98
Margin and Padding     100
Visibility     102
Controlling Position     103
Alignment     103
Content Alignment     104
FlowDirection     105
Applying Transforms     106
RotateTransform     108
ScaleTransform.      109
SkewTransform.      112
TranslateTransform     112
MatrixTransform     112
Combining Transforms     113
Summary     114
 
Chapter 5: Layout with Panels     115
Canvas     116
StackPanel     118
WrapPanel     120
DockPanel     122
Grid     125
Sizing the Rows and Columns     130
Interactive Sizing with GridSplitter     132
Sharing Row and Column Sizes     134
Comparing Grid to Other Panels     136
Primitive Panels     137
TabPanel     137
ToolBarPanel     138
ToolBarOverflowPanel     138
ToolBarTray .      138
UniformGrid.      138
SelectiveScrollingGrid.      138
Handling Content Overflow     139
Clipping     139
Scrolling     141
Scaling     143
Putting It All Together: Creating a Visual Studio-Like Collapsible, Dockable, Resizable Pane     147
Summary      157
 
Chapter 6: Input Events: Keyboard, Mouse, Stylus, and Multi-Touch     159
Routed Events     159
A Routed Event Implementation     160
Routing Strategies and Event Handlers     161
Routed Events in Action     162
Attached Events     165
Keyboard Events     168
Mouse Events     170
MouseEventArgs     171
Drag and Drop     172
Capturing the Mouse     173
Stylus Events     174
StylusDevice     174
Events     175
Multi-Touch Events     176
Basic Touch Events     177
Manipulation Events for Panning, Rotating, and Zooming     180
Commands     188
Built-In Commands     189
Executing Commands with Input Gestures     192
Controls with Built-In Command Bindings     193
Summary     194
 
Chapter 7: Structuring and Deploying an Application     195
Standard Windows Applications     195
The Window Class     196
The Application Class     199
Showing a Splash Screen     205
Creating and Showing Dialogs     206
Persisting and Restoring Application State     209
Deployment: ClickOnce Versus Windows Installer     210
Navigation-Based Windows Applications     211
Pages and Their Navigation Containers     212
Navigating from Page to Page     214
Passing Data Between Pages     219
Gadget-Style Applications     223
XAML Browser Applications     224
Limited Feature Set     226
Integrated Navigation      228
Deployment      229
Loose XAML Pages     231
Summary     232
 
Chapter 8: Exploiting Windows 7     233
Jump Lists     233
JumpTask     234
JumpPath     241
Taskbar Item Customizations     245
Using a Taskbar Item Progress Bar     246
Adding an Overlay to the Taskbar Item     247
Customizing the Thumbnail Content     247
Adding Thumb Buttons to the Taskbar Thumbnail     248
Aero Glass     249
TaskDialog     253
Summary     256
 
Part III Controls
Chapter 9: Content Controls     261
Buttons     263
Button     264
RepeatButton     265
ToggleButton     265
CheckBox     266
RadioButton     266
Simple Containers     268
Label     268
ToolTip     269
Frame     271
Containers with Headers     272
GroupBox     273
Expander     273
Summary     274
 
Chapter 10: Items Controls     275
Common Functionality     276
DisplayMemberPath     277
ItemsPanel     278
Controlling Scrolling Behavior     280
Selectors     281
ComboBox     282
ListBox     287
ListView     290
TabControl     291
DataGrid     292
Menus     298
Menu     298
ContextMenu     301
Other Items Controls     302
TreeView     302
ToolBar     304
StatusBar     307
Summary     308
 
Chapter 11: Images, Text, and Other Controls     309
The Image Control      309
Text and Ink Controls      311
TextBlock     313
TextBox     315
RichTextBox     316
PasswordBox     316
InkCanvas     316
Documents     318
Creating Flow Documents     318
Displaying Flow Documents     329
Adding Annotations     331
Range Controls     334
ProgressBar     335
Slider     335
Calendar Controls     336
Calendar     336
DatePicker     338
Summary     339
 
Part IV Features for Professional Developers
Chapter 12: Resources     343
Binary Resources     343
Defining Binary Resources     344
Accessing Binary Resources     345
Localizing Binary Resources     350
Logical Resources     351
Resource Lookup     355
Static Versus Dynamic Resources     355
Interaction with System Resources     360
Summary     362
 
Chapter 13: Data Binding     363
Introducing the Binding Object     363
Using Binding in Procedural Code     363
Using Binding in XAML     365
Binding to Plain .NET Properties     367
Binding to an Entire Object     369
Binding to a Collection     370
Sharing the Source with DataContext     374
Controlling Rendering     375
String Formatting     375
Using Data Templates     378
Using Value Converters     381
Customizing the View of a Collection     386
Sorting     386
Grouping     388
Filtering     392
Navigating     392
Working with Additional Views     394
Data Providers     396
XmlDataProvider     397
ObjectDataProvider     401
Advanced Topics     403
Customizing the Data Flow     403
Adding Validation Rules to Binding     405
Working with Disjoint Sources     409
Putting It All Together: The Pure-XAML Twitter Client     412
Summary     414
 
Chapter 14: Styles, Templates, Skins, and Themes     415
Styles     416
Sharing Styles     418
Triggers     423
Templates     430
Introducing Control Templates     431
Getting Interactivity with Triggers     432
Restricting the Target Type     434
Respecting the Templated Parent's Properties     435
Respecting Visual States with Triggers     442
Respecting Visual States with the Visual State Manager (VSM)      447
Mixing Templates with Styles     456
Skins     458
Themes     465
Using System Colors, Fonts, and Parameters     465
Per-Theme Styles and Templates     466
Summary     470
 
Part V Rich Media
Chapter 15: 2D Graphics     475
Drawings     476
Geometries     479
Pens     489
Clip Art Example     491
Visuals     493
Filling a DrawingVisual with Content     493
Displaying a Visual on the Screen     496
Visual Hit Testing     499
Shapes     505
Rectangle     507
Ellipse     508
Line     509
Polyline     510
Polygon     511
Path     511
Clip Art Based on Shapes     512
Brushes     513
Color Brushes     513
Tile Brushes     520
Brushes as Opacity Masks     527
Effects     529
Improving Rendering Performance     532
RenderTargetBitmap     532
BitmapCache     533
BitmapCacheBrush     535
Summary     535
 
Chapter 16: 3D Graphics     537
Getting Started with 3D Graphics     538
Cameras and Coordinate Systems     542
Position     543
LookDirection     544
UpDirection     548
OrthographicCamera Versus PerspectiveCamera     551
Transform3D     554
TranslateTransform3D     556
ScaleTransform3D     557
RotateTransform3D     559
Combining Transform3Ds     562
Model3D     563
Lights     563
GeometryModel3D     571
Model3DGroup     584
Visual3D     586
ModelVisual3D     587
UIElement3D     588
Viewport2DVisual3D     590
3D Hit Testing     592
Viewport3D     593
2D and 3D Coordinate System Transformation     596
Visual.TransformToAncestor     596
Visual3D.TransformToAncestor and Visual3D.TransformToDescendant     600
Summary     605
 
Chapter 17: Animation     607
Animations in Procedural Code     608
Performing Animation “By Hand”      608
Introducing the Animation Classes     609
Simple Animation Tweaks     616
Animations in XAML     621
EventTriggers Containing Storyboards     621
Using Storyboard as a Timeline     629
Keyframe Animations     630
Linear Keyframes     631
Spline Keyframes     633
Discrete Keyframes     634
Easing Keyframes     636
Easing Functions     637
Built-In Power Easing Functions     637
Other Built-In Easing Functions     639
Writing Your Own Easing Function     640
Animations and the Visual State Manager     643
Transitions     647
Summary     651
 
Chapter 18: Audio, Video, and Speech     653
Audio     653
SoundPlayer     654
SoundPlayerAction     654
MediaPlayer     655
MediaElement and MediaTimeline     656
Video     658
Controlling the Visual Aspects of MediaElement     658
Controlling the Underlying Media     661
Speech     664
Speech Synthesis     664
Speech Recognition     667
Summary     672
 
Part VI Advanced Topics
Chapter 19: Interoperability with Non-WPF Technologies     675
Embedding Win32 Controls in WPF Applications     677
A Win32 Webcam Control     678
Using the Webcam Control in WPF     681
Supporting Keyboard Navigation     687
Embedding WPF Controls in Win32 Applications     692
Introducing HwndSource     692
Getting the Right Layout     696
Embedding Windows Forms Controls in WPF Applications     699
Embedding a PropertyGrid with Procedural Code     700
Embedding a PropertyGrid with XAML     702
Embedding WPF Controls in Windows Forms Applications     704
Mixing DirectX Content with WPF Content     708
Embedding ActiveX Controls in WPF Applications     714
Summary     718
 
Chapter 20: User Controls and Custom Controls     721
Creating a User Control     723
Creating the User Interface of the User Control     723
Creating the Behavior of the User Control     725
Adding Dependency Properties to the User Control     728
Adding Routed Events to the User Control     731
Creating a Custom Control     732
Creating the Behavior of the Custom Control     733
Creating the User Interface of the Custom Control     739
Considerations for More Sophisticated Controls     743
Summary     750
 
Chapter 21: Layout with Custom Panels     751
Communication Between Parents and Children     752
The Measure Step     752
The Arrange Step     754
Creating a SimpleCanvas     755
Creating a SimpleStackPanel     760
Creating an OverlapPanel     763
Creating a FanCanvas     768
Summary     773
 
Index     775
 

About the author

Adam Nathan is a principal software development engineer for Microsoft Visual Studio, the latest version of which has been transformed into a first-class WPF application. Adam was previously the founding developer and architect for Popfly, Microsoft's first product built on Silverlight, named one of the 25 most innovative products of 2007 by PCWorld Magazine. Having started his career on Microsoft's Common Language Runtime team, Adam has been at the core of .NET and WPF technologies since the very beginning.
 
Adam's books have been considered required reading by many inside Microsoft and throughout the industry. He is the author of the best-selling WPF Unleashed (Sams, 2006) that was nominated for a 2008 Jolt Award, Silverlight 1.0 Unleashed (Sams, 2008), and .NET and COM: The Complete Interoperability Guide (Sams, 2002); a coauthor of ASP.NET: Tips, Tutorials, and Code (Sams, 2001); and a contributor to books including .NET Framework Standard Library Annotated Reference, Volume 2 (Addison-Wesley, 2005) and Windows Developer Power Tools (O'Reilly, 2006). Adam is also the creator of PINVOKE.NET and its Visual Studio add-in. You can find him online at www.adamnathan.net, or @adamnathan on Twitter.

Product details

Authors Adam Nathan
Publisher Sams
 
Languages English
Product format Paperback / Softback
Released 18.12.2010
 
EAN 9780672331190
ISBN 978-0-672-33119-0
No. of pages 848
Dimensions 181 mm x 231 mm x 39 mm
Weight 1556 g
Illustrations w. col. ill.
Series Unleashed
Subject Natural sciences, medicine, IT, technology > IT, data processing > Data communication, networks

Customer reviews

No reviews have been written for this item yet. Write the first review and be helpful to other users when they decide on a purchase.

Write a review

Thumbs up or thumbs down? Write your own review.

For messages to CeDe.ch please use the contact form.

The input fields marked * are obligatory

By submitting this form you agree to our data privacy statement.