(backslash), 34
{ } (curly braces), 33-34, 377
2D and 3D coordinate system transformation, 541, 590-591
explained, 596
Visual.TransformToAncestor method, 596-600
Visual3D.TransformToAncestor method, 600-605
Visual3D.TransformToDescendant method, 600-605
Brushes
BitmapCacheBrush class, 535
DrawingBrush class, 520-524
explained, 513
ImageBrush class, 524-525
LinearGradientBrush class, 515-518
as opacity masks, 527-529
RadialGradientBrush class, 519-520
SolidColorBrush class, 514
VisualBrush class, 525-527
drawings
clip art example, 491-492
Drawing class, 476
DrawingBrush class, 477
DrawingContext methods, 494
DrawingImage class, 477-479
DrawingVisual class, 477
GeometryDrawing class, 476-477
GlyphRunDrawing class, 476
ImageDrawing class, 476-478
Pen class, 489-491
VideoDrawing class, 476
Effects, 529-531
explained, 475-476
geometries
aggregate geometries, 483
Bézier curves, 480
CombinedGeometry class, 486-487
defined, 479
EllipseGeometry class, 479
GeometryGroup class, 484-486
LineGeometry class, 479
PathGeometry class, 479-483
RectangleGeometry class, 479
representing as strings, 487-489
StreamGeometry class, 483
house example, 538
Shapes
clip art based on Shapes, 512-513
Ellipse class, 508
explained, 505-506
how they work, 509
Line class, 509-510
overuse of, 507
Path class, 511-512
Polygon class, 511
Polyline class, 510
Rectangle class, 507-508
transforms. See transforms
Visuals
custom rendering, 499
displaying on screen, 496-498
DrawingContext methods, 494
DrawingVisuals, 493-496
explained, 493
visual hit testing, 499-505
WPF 3.5 enhancements, 15
2D and 3D coordinate system transformation, 541, 590-591
explained, 596
Visual.TransformToAncestor method, 596-600
Visual3D.TransformToAncestor method, 600-605
Visual3D.TransformToDescendant method, 600-605
3D hit testing, 592-593
Cameras
blind spots, 545
coordinate systems, 542-544
explained, 542
LookDirection property, 544-548
MatrixCamera, 553
OrthographicCamera versus PerspectiveCamera, 551-553
Position property, 543-544
Transform property, 549
UpDirection property, 548-550
Z-fighting, 545
coordinate systems, 542-544
explained, 537-538
hardware acceleration
explained, 12
GDI and, 13
house example, 538-540
Lights, 542
Materials
AmbientMaterial, 575
combining, 578
DiffuseMaterial, 572-575
EmissiveMaterial, 576-578
explained, 571
explained, 563
GeometryModel3D, 571
Lights, 563-570
Model3DGroup class, 584-586
pixel boundaries, 17
resolution independence, 12
texture coordinates, 584
Transform3Ds
combining, 562
explained, 554-555
house drawing example, 555-556
MatrixTransform3D class, 554, 562
RotateTransform3D class, 554, 559-562
ScaleTransform3D class, 554, 557-559
Transform3DGroup class, 554
TranslateTransform3D class, 554-557
Viewport2DVisual3D class, 590-591
Viewport3D class, 593-596
Visual3Ds
explained, 586
ModelVisual3D class, 587-588
UIElement3D class, 588-590
WPF 3.5 enhancements, 15
3D hit testing, 592-593
About dialog
attached events, 165-167
with font properties moved to inner StackPanel, 90
with font properties set on root window, 85-86
Help command, 191-192
initial code listing, 75-76
routed events, 162-164
absolute sizing, 130
accessing
binary resources
embedded in another assembly, 348
from procedural code, 349-350
at site of origin, 348-349
from XAML, 345-348
logical resources, 360
Action property (QueryContinueDragEventArgs class), 173
ActiveEditingMode property (InkCanvas class), 317
ActiveX controls, 714-718
ActualHeight property (FrameworkElement class), 100
ActualWidth property (FrameworkElement class), 100
AddBackEntry method, 218
AddHandler method, 160-161
advantages of WPF, 13
Aero Glass, 249-253
aggregate geometries, 483
AlternationCount property (ItemsControl class), 276
AlternationIndex property (ItemsControl class), 276
AmbientMaterial class, 575
AnchoredBlock class, 326-327
AND relationships (logical), 429-430
Angle property (RotateTransform class), 108
AngleX property (SkewTransform class), 112
AngleY property (SkewTransform class), 112
animation classes
AutoReverse property, 618
BeginTime property, 616-617
By property, 616
DoubleAnimation, 611-612
Duration property, 614
EasingFunction property, 620
explained, 609-610
FillBehavior property, 621
From property, 614-616
IsAdditive property, 621
IsCumulative property, 621
lack of generics, 610-611
linear interpolation, 612-613
RepeatBehavior property, 618-619
SpeedRatio property, 617
To property, 614-616
data binding and, 632
easing functions, 16
BackEase, 640
BounceEase, 640
CircleEase, 640
EasingMode property, 637
ElasticEase, 640
ExponentialEase, 640
power easing functions, 637-638
SineEase, 640
writing, 640-642
frame-based animation, 609
keyframe animation
discrete keyframes, 634-636
easing keyframes, 636
explained, 630
linear keyframes, 631-633
spline keyframes, 633-634
path-based animations, 637
reusing animations, 613
timer-based animation, 608-609
and Visual State Manager
Button ControlTemplate with VisualStates, 643-646
transitions, 647-651
with XAML EventTriggers/Storyboards
explained, 621-622
starting animations from property triggers, 628-629
Storyboards as Timelines, 629-630
TargetName property, 625-626
TargetProperty property, 622-625
annotations, adding to flow documents, 331-334
AnnotationService class, 331
Application class
creating applications without, 204
events, 202
explained, 199-200
Properties collection, 203
Run method, 200-201
single-instance applications, 204
Windows collection, 202
ApplicationCommands class, 189
ApplicationPath property (JumpTask), 238
applications
associating Jump Lists with, 234
embedding Win32 controls in WPF applications
explained, 677
keyboard navigation, 687-691
Webcam control, 678-687
embedding Windows Forms controls in WPF applications
explained, 699-700
PropertyGrid, 700-703
embedding WPF controls in Win32 applications
HwndSource class, 692-695
layout, 696-699
embedding WPF controls in Windows Forms applications
converting between two representatives, 707-708
ElementHost class, 704-706
launching modal dialogs, 708
gadget-style applications, 223-224
loose XAML pages, 231-232
multiple-document interface (MDI), 203
navigation-based Windows applications
explained, 211-212
hyperlinks, 215-216
journal, 216-218
Navigate method, 214-215
navigation containers, 212-214
navigation events, 218-219
Page elements, 212-214
returning data from pages, 221-222
sending data to pages, 220-221
standard Windows applications
Application class, 199-204
application state, 209-210
ClickOnce, 210-211
common dialogs, 206-207
custom dialogs, 207-208
explained, 195-196
multithreaded applications, 205
retrieving command-line arguments in, 202
single-instance applications, 204
splash screens, 205-206
Window class, 196-198
Windows Installer, 210
XAML Browser applications (XBAPs)
ClickOnce caching, 226
deployment, 229
explained, 224-226
full-trust XAML Browser applications, 228
integrated navigation, 228-229
limitations, 226-227
on-demand download, 230-231
security, 229
Apply method, 245
arbitrary objects, content and, 263
ArcSegment class, 480
Arguments property (JumpTask), 238
ArrangeOverride method, overriding, 754-755
associating Jump Lists with applications, 234
asynchronous data binding, 401
attached events, 165-167
attached properties
About dialog example, 90-91
as extensibility mechanism, 92-93
attached property providers, 92
defined, 89
attached property providers, 92
attenuation, 566
attributes, setting, 25
audio support
embedded resources, 663
explained, 653
MediaElement, 656-658
MediaPlayer, 655-656
MediaTimeline, 656-658
SoundPlayer, 654
SoundPlayerAction class, 654-655
converting spoken words into text, 667-670
specifying grammar with GrammarBuilder, 671-672
specifying grammar with SRGS, 670-671
speech synthesis
explained, 664
GetInstalledVoices method, 664
PromptBuilder class, 665-667
SelectVoice method, 664
SelectVoiceByHints method, 664
SetOutputToWaveFile method, 665
SpeakAsync method, 664
Speech Synthesis Markup Language (SSML), 665-667
SpeechSynthesizer, 664
SystemSounds class, 654
“Auto” length, 99
automation
automation IDs, 289
UI Automation, supporting in custom controls, 749-750
AutoReverse property (animation classes), 618
autosizing, 128-130
AxisAngleRotation3D class, 559-560
AxMsTscAxNotSafeForScripting control, 716-717
BackEase function, 640
backslash (), 34
BAML (Binary Application Markup Language)
decompiling back into XAML, 47-48
defined, 45
Baml2006Reader class, 53
base values of dependency properties, calculating, 87-88
BaseValueSource enumeration, 88
BeginTime property (animation classes), 616-617
behavior
adding to custom controls
behavior, 737-739
code-behind file, 734
initial implementation, 733-737
resources, 734-735
creating for user controls, 725-727
Bézier curves, 480
BezierSegment class, 480
Binary Application Markup Language (BAML)
decompiling back into XAML, 47-48
defined, 45
binary resources
accessing
embedded in another assembly, 348
from procedural code, 349-350
at site of origin, 348-349
from XAML, 345-348
defining, 344-345
explained, 343
localizing
creating satellite assembly with LocBaml, 351
explained, 350
marking user interfaces with localization IDs, 351
preparing projects for multiple cultures, 350
Binding object. See also data binding
binding
to .NET properties, 367-368
to collections, 370-373
to entire objects, 369-370
to UIElement, 370
DoNothing values, 385
ElementName property, 366
IsAsync property, 401
in procedural code, 363-365
RelativeSource property, 367
removing, 365
sharing source with DataContext, 374-375
StringFormat property, 375-376
TargetNullValue property, 366
UpdateSourceExceptionFilter property, 408
UpdateSourceTrigger property, 404
validation rules, 405-409
ValidationRules property, 406
in XAML, 365-367
BindingMode enumeration, 403
BitmapCache class, 533-535
BitmapCacheBrush class, 535
BitmapEffect, 530
bitmaps
nearest-neighbor bitmap scaling, 310
WriteableBitmap class, 15
BitmapScalingMode property (RenderOptions), 306
BlackoutDates property (Calendar control), 337-338
blind spots (Cameras), 545
Block TextElements
AnchoredBlock class, 326-327
BlockUIContainer, 321
List, 320
Paragraph, 320
sample code listing, 321-324
Section, 320
Table, 320
BlockUIContainer Blocks, 321
BlurEffect, 529-530
BooleanToVisibilityConverter, 383-384
Bottom property (Canvas), 116
BounceEase function, 640
BrushConverter type converter, 32
Brushes
applying without logical resources, 352-353
BitmapCacheBrush class, 535
consolidating with logical resources, 353-355
explained, 513
ImageBrush class, 524-525
LinearGradientBrush class, 515-518
as opacity masks, 527-529
RadialGradientBrush class, 519-524
SolidColorBrush class, 514
VisualBrush class, 525-527
bubbling, 161
BuildWindowCore class, 684
built-in commands, 189-192
ButtonAutomationPeer class, 265
ButtonBase class, 263-264
buttons
Button ControlTemplate with VisualStates, 643-646
ButtonBase class, 263-264
CheckBox class, 266
defined, 263
RadioButton class, 266-268
RepeatButton class, 265
styling with built-in animations, 626-628
ToggleButton class, 265-266
By property (animation classes), 616
C++/CLI, 681-682
cached composition
BitmapCache class, 533-535
BitmapCacheBrush class, 535
Viewport2DVisual3D support for, 591
caching, ClickOnce, 226
Calendar control, 336-338
calendar controls
Calendar, 336-338
DatePicker, 338-339
Cameras
blind spots, 545
coordinate systems, 542-544
explained, 542
LookDirection property, 544-548
MatrixCamera, 553
OrthographicCamera versus PerspectiveCamera, 551-553
Position property, 543-544
Transform property, 549
UpDirection property, 548-550
Z-fighting, 545
CAML (Compiled Application Markup Language), 46
CanUserDeleteRows property (DataGrid), 298
cancel buttons, 264
Cancel method, 185
CanExecute method, 189
CanExecuteChanged method, 189
CanUserAddRows property (DataGrid), 298
Canvas, 116-118. See also SimpleCanvas
mimicking with Grid, 136
capturing mouse events, 173-174
cells (DataGrid), selecting, 295
Center property (RadialGradientBrush), 519
CenterX property
RotateTransform class, 108-110
SkewTransform class, 112
CenterY property
RotateTransform class, 108-110
SkewTransform class, 112
change notification (dependency properties), 83-84
CheckBox class, 266
child object elements
content property, 35-36
dictionaries, 37-38
lists, 36-37
processing rules, 40
values type-converted to object elements, 38
/clr compiler option, 686
CircleEase function, 640
class hierarchy, 73-75
Class keyword, 44
classes. See specific classes
ClearAllBindings method, 365
ClearBinding method, 365
ClearHighlightsCommand, 331
clearing
bindings, 365
local values, 88
ClearValue method, 88
CLI (Common Language Infrastructure), 681
Click event, 263-264
clickable cube example, 588-590
ClickCount property (MouseButtonEventArgs), 172
ClickMode property (ButtonBase class), 263
ClickOnce, 210-211
ClickOnce caching, 226
with unmanaged code, 211
clients, pure-XAML Twitter client, 412-413
clip art example, 491-492
clip art based on Shapes, 512-513
drawing-based implementation, 491-492
DrawingContext-based implementation, 495-496
WindowHostingVisual.cs file, 497
clipboard interaction (DataGrid), 296
ClipboardCopyMode property (DataGrid), 296
clipping, 139-141
ClipToBounds property (panels), 140
clr-namespace directive, 39
CoerceValueCallback delegate, 89
cold start time, 205
Collapsed value (Visibility enumeration), 102
collections
binding to, 370-373
customizing collection views
creating new views, 394-396
explained, 386
filtering, 392
grouping, 388-391
navigating, 392-393
sorting, 386-388
dictionaries, 37-38
ItemsSource, 297
lists, 36-37
Properties, 203
SortDescriptions, 387
Triggers, 85
Windows, 202
CollectionViewSource class, 394
color brushes
applying without logical resources, 352-353
consolidating with logical resources, 353-355
LinearGradientBrush class, 515-518
RadialGradientBrush class, 519-520
SolidColorBrush class, 514
color space profiles, 515
Color structure, 514
columns (Grid)
auto-generated columns, 294-295
column types, 293-294
freezing, 297
sharing row/column sizes, 134-136
sizing
absolute sizing, 130
autosizing, 130
GridLength structures, 131-132
interactive sizing with GridSplitter, 132-133
percentage sizing, 131
proportional sizing, 130
CombinedGeometry class, 486-487
combining
Materials, 578
Transform3Ds, 562
transforms, 113-114
ComboBox control
ComboBoxItem objects, 286-287
customizing selection box, 282-285
events, 282
explained, 282
IsEditable property, 282
IsReadOnly property, 282
SelectionChanged event, 285-286
ComboBoxItem objects, 286-287
ComCtl32.dll, 255-256
command-line arguments, retrieving, 202
commands. See also specific commands
built-in commands, 189-192
controls with built-in command bindings, 193-194
executing with input gestures, 192-193
explained, 188-189
implementing with custom controls, 745
commas in geometry strings, 489
common dialogs, 206-207
Common Language Infrastructure (CLI), 681
Compiled Application Markup Language (CAML), 46
compiling XAML, 43-45
Complete method, 185
CompleteQuadraticEase class, 642
ComponentCommands class, 190
CompositeCollection class, 410
CompositionTarget_Rendering event handler, 713
conflicting triggers, 429
consolidating routed event handlers, 167-168
ConstantAttenuation property (PointLights), 566
containers
Expander class, 273-274
Frame class, 271-272
GroupBox class, 273
Label class, 268
navigation containers, 212-214
ToolTop class, 269-271
ContainerUIElement3D class, 590
Content build action, 344
content controls
and arbitrary objects, 263
buttons
Button class, 264-265
ButtonBase class, 263-264
CheckBox class, 266
defined, 263
RadioButton class, 266-268
RepeatButton class, 265
ToggleButton class, 265-266
containers
Expander class, 273-274
Frame class, 271-272
GroupBox class, 273
Label class, 268
ToolTip class, 269-271
ContentControl class, 262
defined, 262
content overflow, handling
clipping, 139-141
explained, 139
scaling, 143-147
scrolling, 141-143
Content property, 35-36
ContentControl class, 435-437
Frame class, 272
ContentControl class, 262, 435-437
ContentElement class, 74
ContextMenu control, 301-302
ContextMenuService class, 302
Control class, 75
control parts, 744-745
control states, 745-749
ControlTemplate with triggers, 432-434
editing, 457-458
explained, 430-431
mixing with styles, 456-457
named elements, 434
reusability of, 438-440
simple control template, 431-432
target type, restricting, 434-435
TargetType property, 434-435
templated parent properties, respecting
Content property (ContentControl class), 435-437
hijacking existing properties for new purposes, 441
other properties, 438-440
triggers, 432-434
visual states
respecting with triggers, 442-446
respecting with VSM (Visual State Manager), 447-455
controls
ActiveX controls, 714-718
buttons
Button class, 264-265
ButtonBase class, 263-264
CheckBox class, 266
defined, 263
RadioButton class, 266-268
RepeatButton class, 265
ToggleButton class, 265-266
Calendar, 336-338
ComboBox
ComboBoxItem objects, 286-287
customizing selection box, 282-285
events, 282
explained, 282
IsEditable property, 282
IsReadOnly property, 282
SelectionChanged event, 285-286
containers
Expander class, 273-274
Frame class, 271-272
GroupBox class, 273
Label class, 268
ToolTip class, 269-271
ContextMenu, 301-302
control parts, 447-449
control states, 449-455
controls with built-in command bindings, 193-194
custom controls, creating
behavior, 733-739
code-behind file, 734
commands, 745
control parts, 744-745
control states, 745-749
generic resources, 741-742
resources, 734-735
UI Automation, 749-750
user controls versus custom controls, 722
DataGrid, 293
auto-generated columns, 294-295
CanUserAddRows property, 298
CanUserDeleteRows property, 298
clipboard interaction, 296
ClipboardCopyMode property, 296
column types, 293-294
displaying row details, 296-297
editing data, 297-298
EnableColumnVirtualization property, 296
EnableRowVirtualization property, 296
example, 292-293
freezing columns, 297
FrozenColumnCount property, 297
RowDetailsVisibilityMode property, 297
selecting rows/cells, 295
SelectionMode property, 295
SelectionUnit property, 295
virtualization, 296
DatePicker, 338-339
explained, 261-263
GridView, 290-291
InkCanvas, 316-318
ItemsControl class, 275-276
AlternationCount property, 276
AlternationIndex property, 276
DisplayMemberPath property, 276-277
HasItems property, 276
IsGrouping property, 276
IsTextSearchCaseSensitive property, 285
IsTextSearchEnabled property, 285
Items property, 275
ItemsPanel property, 276-280
ItemsSource property, 276
scrolling behavior, controlling, 280-281
ListBox
automation IDs, 289
example, 287-288
scrolling, 289
SelectionMode property, 288
sorting items in, 289
support for multiple selections, 288
ListView, 290-291
Menu, 298-301
PasswordBox, 316
ProgressBar, 335
RichTextBox, 316
ScrollViewer, 141-143
Selector class, 281
Slider, 335-336
states, 745-749
StatusBar, 307-308
TabControl, 291-292
TextBlock
explained, 313
explicit versus implicit runs, 314
properties, 313
support for multiple lines of text, 315
whitespace, 314
TextBox, 315
ToolBar, 304-306
TreeView, 302-304
user controls, creating
behavior, 725-727
dependency properties, 728-731
explained, 721-722
protecting controls from accidental usage, 727-728
routed events, 731-732
user controls versus custom controls, 722
user interfaces, 723-725
ControlTemplate class. See control templates
Convert method, 382
converting spoken words into text, 667-670
ConvertXmlStringToObjectGraph method, 65
coordinate systems, 542-544
CountToBackgroundConverter class, 382-384
CreateBitmapSourceFromHBitmap method, 708
CreateHighlightCommand, 331
CreateInkStickyNoteCommand, 331
CreateTextStickyNoteCommand, 331
CreateWindow method, 685
Cube example
clickable cube, 588-590
cube and TextBlocks, 600-604
cube button style, 594-595
cube of buttons and small purple cube, 597-599
initial code listing, 585-586
cultures, preparing projects for multiple cultures, 350
curly braces ({}), 33-34
CurrentItem property (ICollectionView), 392
curves, Bézier, 480
CustomCategory property (JumpTask), 239-240
customization
advantages/disadvantages, 416
collection views
creating new views, 394-396
explained, 386
filtering, 392
grouping, 388-391
navigating, 392-393
sorting, 386-388
color space profiles, 515
custom controls, creating
behavior, 733-739
commands, 745
control parts, 744-745
control states, 745-749
explained, 721-722
generic resources, 741-742
UI Automation, 749-750
user controls versus custom controls, 722
user interfaces, 739-742
custom rendering, 499
custom sorting, 388
data display, 385
data flow, 403-405
dialogs, 207-208
JumpTask behavior, 237-240
keyboard navigation, 306
panels
communication between parents and children, 752-755
explained, 751-752
selection boxes (ComboBox control), 282-285
taskbar
explained, 245-246
taskbar item progress bars, 246
taskbar overlays, 247
thumb buttons, 248-249
thumbnail content, 247
D3DImage class, 708-714
DashStyle class, 490-491
DashStyle property (Pen class), 490
data binding, 15
animation and, 632
asynchronous data binding, 401
Binding object, 363
binding to .NET properties, 367-368
binding to collections, 370-373
binding to entire objects, 369-370
binding to UIElement, 370
ElementName property, 366
IsAsync property, 401
in procedural code, 363-365
RelativeSource property, 367
removing, 365
sharing source with DataContext, 374-375
StringFormat property, 375-376
TargetNullValue property, 366
UpdateSourceExceptionFilter property, 408
UpdateSourceTrigger property, 404
validation rules, 405-409
ValidationRules property, 406
in XAML, 365-367
canceling temporarily, 385
CompositeCollection class, 410
controlling rendering
data templates, 378-380
explained, 375
string formatting, 375-377
value converters, 381-386
customizing collection views
creating new views, 394-396
explained, 386
filtering, 392
grouping, 388-391
navigating, 392-393
sorting, 386-388
customizing data flow, 403-405
data providers
explained, 396
ObjectDataProvider class, 401-403
XmlDataProvider class, 397-401
defined, 363
Language Integrated Query (LINQ), 396
to methods, 402-403
MultiBinding class, 410-411
PriorityBinding class, 411
pure-XAML Twitter client, 412-413
troubleshooting, 384
data flow, customizing, 403-405
Data property (DragEventArgs class), 172
data providers
explained, 396
ObjectDataProvider class, 401-403
XmlDataProvider class, 397-401
data templates, 378-380
HierarchicalDataTemplate, 399-400
template selectors, 381
data types
bridging incompatible data types, 381-384
in XAML 2009, 50
DataContext property, 374-375
DataGrid control
CanUserAddRows property, 298
CanUserDeleteRows property, 298
clipboard interaction, 296
ClipboardCopyMode property, 296
column types, 293-295
displaying row details, 296-297
editing data, 297-298
EnableColumnVirtualization property, 296
EnableRowVirtualization property, 296
example, 292-293
freezing columns, 297
FrozenColumnCount property, 297
RowDetailsVisibilityMode property, 297
selecting rows/cells, 295
SelectionMode property, 295
SelectionUnit property, 295
virtualization, 296
DataGridCheckBoxColumn, 294
DataGridComboBoxColumn, 294
DataGridHyperlinkColumn, 293
DataGridTemplateColumn, 294
DataGridTextColumn, 293
DataTrigger class, 427-428
DatePicker control, 338-339
DateValidationError event, 339
DayOfWeek enumeration, 338
DeadCharProcessedKey property (KeyEventArgs class), 168
debugger (Visual C++), 695
declaration context, 375
declarative programming, 12
decorators, 144
default buttons, 264
default styles, 88
defining
binary resources, 344-345
object elements, 25
properties, 53
delegates
CoerceValueCallback, 89
delegate contravariance, 168
ValidateValueCallback, 89
DeleteStickyNotesCommand, 331
dependency properties, 419-420
adding to user controls, 728-731
attached properties
About dialog example, 90-91
attached property providers, 92
defined, 89
as extensibility mechanism, 92-93
attached property providers, 92
change notification, 83-84
explained, 80-81
hijacking, 441
implementation, 81-83
property triggers, 83-85
property value inheritance, 85-86
support for multiple providers
applying animations, 89
coercion, 89
determining base values, 87-88
evaluating, 89
explained, 87
validation, 89
DependencyObject class, 74, 82
DependencyPropertyHelper class, 88
deployment
ClickOnce, 210-211
Windows Installer, 210
WPF 3.5 enhancements, 16
WPF 4 enhancements, 17
XAML Browser applications, 229
DesiredSize property (FrameworkElement class), 99
DestroyWindowCore class, 684
device-independent pixels, 102
DialogFunction method, 694
dialogs
About dialog
with font properties moved to inner StackPanel, 90
with font properties set on root window, 85-86
initial code listing, 75-76
common dialogs, 206-207
custom dialogs, 207-208
dialog results, 208
modal dialogs
launching from Win32 applications, 699
launching from Windows Forms applications, 708
launching from WPF applications, 692, 703
modeless dialogs, 196
TaskDialogs, 253-256
DiffuseMaterial, 572-575
direct routing, 161
Direct3D, 12
Direction property
DirectionalLight, 564
PointLights, 568
DirectionalLight, 564-565
directives. See specific directives
development of, 10-11
versus WPF, 13-14
when to use, 13-14
WPF interoperability, 15, 708-714
discrete keyframes, 634-636
DispatcherObject class, 74
DispatcherPriority enumeration, 205
DispatcherTimer class, 608-609
DisplayDateEnd property (Calendar control), 337
DisplayDateStart property (Calendar control), 337
displaying
flow documents, 329-331
Visuals on screen, 496-498
DisplayMemberPath property, 276-277, 371
Dock property (DockPanel), 122
DockPanel
examples, 122-125
explained, 122
interaction with child layout properties, 125
mimicking with Grid, 136
properties, 122
documents, flow
annotations, 331-334
Blocks
AnchoredBlock class, 326-327
BlockUIContainer, 321
List, 320
Paragraph, 320
sample code listing, 321-324
Section, 320
Table, 320
creating, 318-319
defined, 318
displaying, 329-331
Inlines
AnchoredBlock, 326-327
defined, 324-325
InlineUIContainer, 329
LineBreak, 327
Span, 325-326
DoNothing value (Binding), 385
DoubleAnimation class, 611-612
download groups, 230
DownloadFileGroupAsync method, 231
drag-and-drop events, 172-173
DragEventArgs class, 172
Drawing class, 476
DrawingBrush class, 477, 520-524
DrawingContext class
clip art example, 495-496
methods, 494
DrawingImage class, 477-479
drawings
clip art example, 491-492
Drawing class, 476
DrawingBrush class, 477
DrawingContext methods, 494
DrawingImage class, 477-479
DrawingVisual class, 477
geometries. See geometries
GeometryDrawing class, 476-477
GlyphRunDrawing class, 476
ImageDrawing class, 476-478
Pen class, 489-491
VideoDrawing class, 476
WPF 3.5 enhancements, 15
DrawingVisuals
filling with content, 493-496
DropDownOpened event, 282
DropShadowEffect, 529-530
duration of animations, controlling, 614
Duration property (animation classes), 614
DwmExtendFrameIntoClientArea method, 249-252
dynamic versus static resources, 355-357
DynamicResource markup extension, 356-357
Ease method, 640
EaseIn method, 642-643
EaseInOut method, 642-643
easing functions, 16
easing keyframes, 636
EasingFunction property (animation classes), 620
EasingFunctionBase class, 641
EasingMode property (easing functions), 637
editing
control templates, 457-458
DataGrid data, 297-298
EditingCommands class, 190
EditingMode property (InkCanvas class), 317
EditingModeInverted property (InkCanvas class), 317
Effects, 529-531
ElasticEase function, 640
element trees. See trees
ElementHost class, 704-706
ElementName property (Binding object), 366
elements. See object elements; property elements
EllipseGeometry class, 479
embedded resources, 663
EmbeddedResource build action, 345
embedding
ActiveX controls in WPF applications, 714-718
Win32 controls in WPF applications
explained, 677
keyboard navigation, 687-691
Webcam control, 678-687
Windows Forms controls in WPF applications
explained, 699-700
PropertyGrid, 700-703
WPF controls in Win32 applications
HwndSource class, 692-695
layout, 696-699
WPF controls in Windows Forms applications
converting between two representatives, 707-708
ElementHost class, 704-706
launching modal dialogs, 708
EmissiveMaterial class, 576-578
EnableClearType property (BitmapCache class), 534
EnableColumnVirtualization property (DataGrid), 296
EnableRowVirtualization property (DataGrid), 296
EnableVisualStyles method, 703
EndLineCap property (Pen class), 489
EndMember value (NodeType property), 57
EndObject value (NodeType property), 57
EndPoint property (LinearGradientBrush), 516
enumerations
BaseValueSource, 88
BindingMode, 403
DayOfWeek, 338
DispatcherPriority, 205
GeometryCombineMode, 486
GradientSpreadMethod, 517
JumpItemRejectionReason, 244
Key, 168-169
MouseButtonState, 171
PixelFormats, 311
RoutingStrategy, 161
ShutdownMode, 202
Stretch, 144
StretchDirection, 144
TileMode, 523
UpdateSourceTrigger, 404-405
Visibility, 102-103
error handling, 407-409
Error ProgressState, 246
EscapePressed property (QueryContinueDragEventArgs class), 173
Euler angles, 560
EvenOdd fill (FillRule property), 482
event handlers, 52
event wrappers, 160
events
attributes, 25
Click, 263-264
DateValidationError, 339
DropDownOpened, 282
event wrappers, 160
JumpItemsRejected, 244
JumpItemsRemovedByUser, 244
keyboard events, 168-170
mouse events
capturing, 173-174
drag-and-drop events, 172-173
explained, 170-171
MouseButtonEventArgs, 171
MouseEventArgs, 171-172
MouseWheelEventArgs, 171
transparent and null regions, 171
multi-touch events
basic touch events, 177-180
explained, 176
manipulation events, 180-188
navigation events, 218-219
order of processing, 26
Rendering, 609
routed events
About dialog example, 162-164
adding to user controls, 731-732
attached events, 165-167
consolidating routed event handlers, 167-168
defined, 159
explained, 159-160
implementation, 160-161
RoutedEventArgs class, 162
routing strategies, 161-162
stopping, 165
SelectedDatesChanged, 339
SelectionChanged, 281, 285-286
stylus events, 174-176
ExceptionValidationRule object, 407
Execute method, 189
executing commands with input gestures, 192-193
Expander class, 273-274
Expansion property (ManipulationDelta class), 181
explicit sizes, avoiding, 99
explicit versus implicit runs, 314
ExponentialEase function, 640
Expression Blend, 14
expressions, 89
ExtendGlassFrame method, 252
extensibility mechanisms, attached properties as, 92-93
extensibility of XAML, 39
Extensible Application Markup Language. See XAML
factoring XAML, 357
FanCanvas, 768-772
FileInputBox control
behavior, 725-727
dependency properties, 728-731
protecting from accidental usage, 727-728
routed events, 731-732
user interface, 723-725
files. See also specific files
code-behind files, 44
MainWindow.xaml.cs, 178-179, 186-187
raw project files, opening in Visual Studio, 350
VisualStudioLikePanes.xaml, 151-153
VisualStudioLikePanes.xaml.cs, 153-157
FillBehavior property (animation classes), 621
FillRule property (PathGeometry class), 482-483
Filter property (ICollectionView), 392
filtering, 392
finding type converters, 32
FindResource method, 359
FirstDayOfWeek property (Calendar control), 338
Flat line cap (Pen), 490
flow documents
annotations, 331-334
Blocks
AnchoredBlock class, 326-327
BlockUIContainer, 321
List, 320
Paragraph, 320
sample code listing, 321-324
Section, 320
Table, 320
creating, 318-319
defined, 318
displaying, 329-331
Inlines
AnchoredBlock, 326-327
defined, 324-325
InlineUIContainer, 329
LineBreak, 327
Span, 325-326
FlowDirection property (FrameworkElement class), 105-106
FlowDocument element, 318
FlowDocumentPageViewer control, 329
FlowDocumentReader control, 329-333
FlowDocumentScrollViewer control, 329
FontSizeConverter type converter, 32
FormatConvertedBitmap class, 310
formatting strings, 375-377
frame-based animation, 609
FrameworkContentElement class, 75, 80, 318
FrameworkElement class
ActualHeight property, 100
ActualWidth property, 100
DesiredSize property, 99
FlowDirection property, 105-106
Height property, 98-100
HorizontalAlignment property, 103-104
HorizontalContentAlignment property, 104-106
LayoutTransform property, 106
Margin property, 100-102
Padding property, 100-102
RenderSize property, 99
RenderTransform property, 106
Triggers property, 85
VerticalAlignment property, 103-105
Visibility property, 102-103
Width property, 98-100
FrameworkPropertyMetadata, 731
Freezable class, 74
freezing columns, 297
From property (animation classes), 614-616
FromArgb method, 707
FrozenColumnCount property (DataGrid), 297
full-trust XAML Browser applications, 228
functions. See specific functions
gadget-style applications, 223-224
GDI (graphics device interface), 10
GDI+, 10
hardware acceleration and, 13
generated source code, 46
generic dictionaries, 467, 741-742
generics support (XAML2009), 49
aggregate geometries, 483
Bézier curves, 480
CombinedGeometry class, 486-487
defined, 479
EllipseGeometry class, 479
Geometry3D class, 578
GeometryGroup class, 484-486
LineGeometry class, 479
MeshGeometry3D class, 578-579
Normals property, 581-583
Positions property, 579
TextureCoordinates property, 583
TriangleIndices property, 580-581
PathGeometry class
ArcSegment, 480
BezierSegment, 480
example, 480-482
explained, 479
FillRule property, 482-483
LineSegment, 480
PolyBezierSegment, 480
PolyLineSegment, 480
PolyQuadraticBezierSegment, 480
QuadraticBezierSegment, 480
RectangleGeometry class, 479
representing as strings, 487-489
StreamGeometry class, 483
Geometry3D class, 578
GeometryCombineMode enumeration, 486
GeometryDrawing class, 476-477
GeometryGroup class, 484-486
GeometryModel3D
defined, 563
explained, 571
Geometry3D class, 578
AmbientMaterial, 575
combining, 578
DiffuseMaterial, 572-575
EmissiveMaterial, 576-578
explained, 571
MeshGeometry3D class, 578-579
Normals property, 581-583
Positions property, 579
TextureCoordinates property, 583
TriangleIndices property, 580-581
GetCommandLineArgs method, 202
GetExceptionForHR method, 51
GetGeometry method, 479
GetHbitmap function, 708
GetInstalledVoices method, 664
GetIntermediateTouchPoints method, 177
GetObject value (NodeType property), 57
GetPosition method, 171-175
GetTouchPoint method, 177
GetValueSource method, 88
GetVisualChild method, 497-498
GlyphRunDrawing class, 476
GradientOrigin property (RadialGradientBrush), 519
gradients
GradientSpreadMethod enumeration, 517
GradientStop objects, 515
LinearGradientBrush class, 515-518
RadialGradientBrush class, 519-520
transparent colors, 520
GradientSpreadMethod enumeration, 517
GradientStop objects, 515
GrammarBuilder class, 671-672
grammars
GrammarBuilder class, 671-672
Speech Recognition Grammar Specification (SRGS), 670-671
graphics device interface (GDI), 10
graphics hardware, advances in, 11
graphics. See 2D graphics; 3D graphics
cell properties, 128
compared to other panels, 136
explained, 125
interaction with child layout properties, 137
interactive sizing with GridSplitter, 132-133
mimicking Canvas with, 136
mimicking DockPanel with, 136
mimicking StackPanel with, 136
sharing row/column sizes, 134-136
ShowGridLines property, 129
sizing rows/columns
absolute sizing, 130
autosizing, 130
GridLength structures, 131-132
percentage sizing, 131
proportional sizing, 130
start page with Grid, 126-129
GridLength structures, 131-132
GridLengthConverter, 131
GridSplitter class, 132-133
GridView control, 290-291
GridViewColumn object, 290
GroupBox control, 273
GroupDescriptions property (ICollectionView), 388
grouping, 388-391
GroupName property (RadioButton class), 267
Handled property (RoutedEventArgs class), 162
HandleRef, 684
hardware acceleration, 12-13
HasContent property (ContentControl class), 262
HasItems property (ItemsControl class), 276
Header property (ToolBar), 306
headered items controls, 299
HeaderedItemsControl class, 299
headers, containers with headers
Expander class, 273-274
GroupBox class, 273
Height property (FrameworkElement class), 98-100
Help command, 191-192
Hidden value (Visibility enumeration), 102
HierarchicalDataTemplate class, 380, 399-400
hijacking dependency properties, 441
Hillberg, Mike, 384
hit testing
3D hit testing, 592-593
input hit testing
explained, 499
InputHitTest method, 513
visual hit testing
callback methods, 505
explained, 499
with multiple Visuals, 500-503
with overlapping Visuals, 503-505
simple hit testing, 499-500
HitTest method, 502-505
HitTestCore method, 505
HitTestFilterCallback delegate, 504
HitTestResultCallback delegates, 503
HorizontalAlignment property (FrameworkElement class), 103-104
HorizontalContentAlignment property (FrameworkElement class), 104-105
HostingWin32.cpp file, 685
HostingWPF.cpp file, 693-697
house drawing, 538-539
2D drawing, 538
3D drawing, 539-540
Transform3Ds, 555-556
HwndHost class, 685
HwndSource class, 692-695
HwndSource variable, 697-698
hyperlinks, 215-216
ICC (International Color Consortium), 515
ICommand interface, 189
Icon property (MenuItem class), 299
IconResourceIndex property (JumpTask), 238
IconResourcePath property (JumpTask), 238
ICustomTypeDescriptor interface, 368
IEasingFunction interface, 640
IList interface, 36
Image control, 309-311
ImageBrush class, 524-525
images. See 2D graphics; 3D graphics
ImageSource class, 310
ImageSourceConverter type converter, 309
ImeProcessedKey property (KeyEventArgs class), 168
immediate-mode graphics systems, 14, 475
implicit .NET namespaces, 27
implicit styles, creating, 421-422
implicit versus explicit runs, 314
InAir property (StylusDevice class), 174
Indeterminate ProgressState, 246
inertia, enabling, 183-188
Ingebretsen, Robby, 23
inheritance
class hierarchy, 73-75
property value inheritance, 85-86
styles, 418
InitializeComponent method, 46-48, 198
InitialShowDelay property (ToolTip class), 270
InkCanvas class, 316-318
Inline elements
AnchoredBlock, 326-327
defined, 324-325
InlineUIContainer, 329
LineBreak, 327
Span, 325-326
Inlines property (TextBlock control), 314
InlineUIContainer class, 329
InnerConeAngle property (PointLights), 568
input gestures, executing commands with, 192-193
input hit testing
explained, 499
InputHitTest method, 513
InputGestureText property (MenuItem class), 300
InputHitTest method, 513
inspecting WPF elements, 14
instantiating objects
with factory methods, 51-52
with non-default constructors, 51
integration of WPF, 11
IntelliSense, 71
intensity of lights, 565
interfaces. See specific interfaces
International Color Consortium (ICC), 515
interoperability (WPF)
ActiveX content, 714-718
C++/CLI, 681
explained, 675-677
overlapping content, 677
Win32 controls
explained, 677
HwndSource class, 692-695
keyboard navigation, 687-691
launching modal dialogs, 692, 699
layout, 696-699
Webcam control, 678-687
Windows Forms controls
converting between two representatives, 707-708
ElementHost class, 704-706
explained, 699-700
launching modal dialogs, 703, 708
PropertyGrid, 700-703
InvalidItem value (JumpItemRejectionReason enumeration), 244
Inverted property (StylusDevice class), 174
IsAdditive property (animation classes), 621
IsAsync property (Binding object), 401
IsCheckable property (MenuItem class), 299
IsChecked property (ToggleButton class), 265
IsCumulative property (animation classes), 621
IsDefault property (Button class), 81, 264
IsDefaulted property (Button class), 264
IsDown property (KeyEventArgs class), 168
IsEditable property (ComboBox), 282
IsFrontBufferAvailableChanged event handler, 712
IsGrouping property (ItemsControl class), 276
IsIndeterminate property (ProgressBar control), 335
IsKeyboardFocused property (UIElement class), 170
IsKeyDown method, 169
IsMouseDirectlyOver property (UIElement class), 171
IsNetworkDeployed method, 231
isolated storage, 209-210
IsolatedStorage namespace, 210
IsolatedStorageFile class, 210
IsolatedStorageFileStream class, 210
IsPressed property (ButtonBase class), 263
IsReadOnly property (ComboBox), 282
IsRepeat property (KeyEventArgs class), 168
IsSelected property (Selector class), 281
IsSelectionActive property (Selector class), 281
IsSynchronizedWithCurrentItem method, 373
IsSynchronizedWithCurrentItem property (Selector), 373
IsTextSearchCaseSensitive property (ItemsControl class), 285
IsTextSearchEnabled property (ItemsControl class), 285
IsThreeState property (ToggleButton class), 265
IsToggled property (KeyEventArgs class), 168
IsUp property (KeyEventArgs class), 168
ItemHeight property (WrapPanel), 120
items controls
ComboBox
ComboBoxItem objects, 286-287
customizing selection box, 282-285
events, 282
explained, 282
IsEditable property, 282
IsReadOnly property, 282
SelectionChanged event, 285-286
ContextMenu, 301-302
DataGrid
auto-generated columns, 294-295
CanUserAddRows property, 298
CanUserDeleteRows property, 298
clipboard interaction, 296
ClipboardCopyMode property, 296
column types, 293-294
displaying row details, 296-297
editing data, 297-298
EnableColumnVirtualization property, 296
EnableRowVirtualization property, 296
example, 292-293
freezing columns, 297
FrozenColumnCount property, 297
RowDetailsVisibilityMode property, 297
selecting rows/cells, 295
SelectionMode property, 295
SelectionUnit property, 295
virtualization, 296
GridView, 290-291
ItemsControl class
AlternationCount property, 276
AlternationIndex property, 276
DisplayMemberPath property, 276-277
HasItems property, 276
IsGrouping property, 276
IsTextSearchCaseSensitive property, 285
IsTextSearchEnabled property, 285
Items property, 275
ItemsPanel property, 276-280
ItemsSource property, 276
ListBox
automation IDs, 289
example, 287-288
scrolling, 289
SelectionMode property, 288
sorting items in, 289
support for multiple selections, 288
ListView, 290-291
Menu, 298-301
scrolling behavior, controlling, 280-281
Selector class, 281
StatusBar, 307-308
TabControl, 291-292
ToolBar, 304-306
TreeView, 302-304
items panels, 278
Items property (ItemsControl class), 275, 373
ItemsCollection object, 289
ItemsControl class
AlternationCount property, 276
AlternationIndex property, 276
DisplayMemberPath property, 276-277
HasItems property, 276
IsGrouping property, 276
IsTextSearchCaseSensitive property, 285
IsTextSearchEnabled property, 285
Items property, 275
ItemsPanel property, 276-280
ItemsSource property, 276
scrolling behavior, controlling, 280-281
ItemsPanel property (ItemsControl class), 276-280
ItemsSource collection, 297
ItemsSource property (ItemsControl class), 276, 373
ItemWidth property (WrapPanel), 120
IValueConverter interface, 382-383
IXamlLineInfo interface, 58
journal, 216-218
JournalOwnership property (Frame class), 216-217
Jump Lists
associating with applications, 234
explained, 233-234
JumpPaths
adding, 242-243
explained, 241
recent and frequent JumpPaths, 243-244
responding to rejected or removed items, 244
JumpTasks
customizing behavior of, 237-240
example, 235
explained, 234
and Visual Studio debugger, 236
JumpItemRejectionReason enumeration, 244
JumpItemsRejected event, 244
JumpItemsRemovedByUser event, 244
JumpPaths
adding, 242-243
explained, 241
recent and frequent JumpPaths, 243-244
responding to rejected or removed items, 244
JumpTasks
customizing behavior of, 237-240
example, 235
explained, 234
Kaxaml, 22-23
Key enumeration, 168-169
Key property (KeyEventArgs class), 168
keyboard events, 168-170
keyboard navigation
customizing, 306
supporting in Win32 controls, 687-688
access keys, 691
tabbing into Win32 content, 688-689
tabbing out of Win32 content, 689-690
KeyboardDevice property (KeyEventArgs class), 168
KeyboardNavigation class, 306
KeyDown event, 168
KeyEventArgs class, 168
keyframe animation
discrete keyframes, 634-636
easing keyframes, 636
explained, 630
linear keyframes, 631-633
spline keyframes, 633-634
keyless resources, 422-423
KeyStates property
KeyEventArgs class, 168
QueryContinueDragEventArgs class, 173
KeyUp event, 168
keywords. See specific keywords
Label class, 268
Language Integrated Query (LINQ), 396
LastChildFill property (DockPanel), 122
launching modal dialogs
from Win32 applications, 699
from Windows Forms applications, 708
from WPF applications, 692, 703
layout
content overflow, handling
clipping, 139-141
explained, 139
scaling, 143-147
scrolling, 141-143
custom panels
communication between parents and children, 752-755
explained, 751-752
FanCanvas, 768-772
OverlapPanel, 763-768
SimpleCanvas, 755-760
SimpleStackPanel, 760-763
explained, 97-98
panels
Canvas, 116-118
DockPanel, 122-125
explained, 115-116
Grid. See Grid
SelectiveScrollingGrid, 138-139
StackPanel, 118-119
TabPanel, 137
ToolBarOverflowPanel, 138
ToolBarPanel, 138
ToolBarTray, 138
UniformGrid, 138
WrapPanel, 120-122
positioning elements
content alignment, 104-105
explained, 103
flow direction, 105-106
horizontal and vertical alignment, 103-104
stretch alignment, 104
sizing elements
explained, 98
explicit sizes, avoiding, 99
height and width, 98-100
margin and padding, 100-102
visibility, 102-103
transforms
applying, 106-107
combining, 113-114
explained, 106
MatrixTransform, 112-113
RotateTransform, 108-109
ScaleTransform, 109-111
SkewTransform, 112
support for, 114
TranslateTransform, 112
Visual Studio-like panes, creating
sequential states of user interface, 147-151
VisualStudioLikePanes.xaml, 151-153
VisualStudioLikePanes.xaml.cs, 153-157
LayoutTransform property (FrameworkElement class), 106
Left property (Canvas), 116
LengthConverter type converter, 102
Light and Fluffy skin example, 463-464
Light objects
defined, 563
DirectionalLight, 564-565
intensity of, 565
PointLight, 564-566
Line class, 509-510
linear interpolation, 612-613
linear keyframes, 631-633
LinearAttenuation property (PointLights), 566
LinearGradientBrush class, 515-518
LineBreak class, 327
LineGeometry class, 479
LineJoin property (Pen class), 490
LineSegment class, 480
LINQ (Language Integrated Query), 396
ListBox control
arranging items horizontally, 279
automation IDs, 289
example, 287-288
placing PlayingCards custom control into, 742
scrolling, 289
SelectionMode property, 288
sorting items in, 289
support for multiple selections, 288
lists, 36-37
Jump Lists
associating with applications, 234
explained, 233-234
JumpPaths, 241-244
JumpTasks, 234-240
and Visual Studio debugger, 236
ListBox control
arranging items horizontally, 279
automation IDs, 289
example, 287-288
placing PlayingCards custom control into, 742
scrolling, 289
SelectionMode property, 288
sorting items in, 289
support for multiple selections, 288
ListView control, 290-291
ListView control, 290-291
live objects, writing to, 61-63
LoadAsync method, 41
LoadComponent method, 47
loading XAML at runtime, 40-42
Lobo, Lester, 23
local values, clearing, 88
localization IDs, marking user interfaces with, 351
localizing binary resources
creating satellite assembly with LocBaml, 351
explained, 350
marking user interfaces with localization IDs, 351
preparing projects for multiple cultures, 350
LocBaml, creating satellite assembly with, 351
locking D3DImage, 713
logical AND relationships, 429-430
logical OR relationships, 429
logical resources
accessing directly, 360
consolidating color brushes with, 353-355
defining and applying in procedural code, 359-360
explained, 351-352
interaction with system resources, 360-361
resource lookup, 355
resources without sharing, 358
static versus dynamic resources, 355-357
logical trees, 75-80
LogicalChildren property, 80
LogicalTreeHelper class, 77
LookDirection property (Cameras), 544-548
lookup, resource lookup, 355
loose XAML pages, 231-232
mage.exe command-line tool, 210
mageUI.exe graphical tool, 210
Main method, 199-201
MainWindow class, 197-198
MainWindow.xaml file, 710
MainWindow.xaml.cs file, 178-179, 186-187, 710-712
malicious skins, preventing, 464-465
managed code, mixing with unmanaged code, 682
manipulation events
adding inertia with, 183-188
enabling panning/rotating/zooming with, 182-183
explained, 180-181
ManipulationCompleted, 181
ManipulationDelta, 181
ManipulationStarted, 181
ManipulationStarting, 181
ManipulationBoundaryFeedback event, 185
ManipulationCompleted event, 181
ManipulationDelta event, 181-183
ManipulationDeltaEventArgs instance, 181
ManipulationInertiaStarting event, 183, 187
ManipulationStarted event, 181
ManipulationStarting event, 181
Margin property (FrameworkElement class), 100-102
marking user interfaces with localization IDs, 351
markup compatibility, 61
markup extensions
explained, 32-35
parameters, 33
in procedural code, 35
AmbientMaterial, 575
combining, 578
DiffuseMaterial, 572-575
EmissiveMaterial, 576-578
explained, 571
MatrixCamera class, 553
MatrixTransform, 112-113
MatrixTransform3D class, 562
MDI (multiple-document interface), 203
MeasureOverride method, overriding, 752-754
MediaCommands class, 190
MediaElement class
playing audio, 656-658
playing video, 658-660
MediaPlayer class, 655-656
MediaTimeline class
playing audio, 656-658
playing video, 661-662
Menu control, 298-301
MenuItem class, 299
menus
ContextMenu control, 301-302
Menu control, 298-301
MenuItem class, 299
MergedDictionaries property (ResourceDictionary class), 357
MeshGeometry3D class, 578-579
Normals property, 581-583
Positions property, 579
TextureCoordinates property, 583
TriangleIndices property, 580-581
methods, binding to, 402-403. See also specific methods
Microsoft Anna, 664
missing styles, troubleshooting, 461
mnemonics, 691
modal dialogs, launching
from Win32 applications, 699
from Windows Forms applications, 708
from WPF applications, 692, 703
Model3DGroup class, 563, 584-586
Model3Ds
explained, 563
GeometryModel3D
defined, 563
explained, 571
Geometry3D class, 578
Materials, 571-578
MeshGeometry3D class, 578-583
Lights
DirectionalLight, 564-565
explained, 563
intensity of, 565
PointLight, 564-566
SpotLight, 564-568
Model3DGroup class, 563, 584-586
modeless dialogs, 196
ModelUIElement3D class, 588-590
ModelVisual3D class, 587-588
Modifiers property (KeyboardDevice), 169
Mouse class, 173
mouse events
capturing, 173-174
drag-and-drop events, 172-173
explained, 170-171
MouseButtonEventArgs, 171
MouseEventArgs, 171-172
MouseWheelEventArgs, 171
transparent and null regions, 171
MouseButtonEventArgs class, 171
MouseButtonState enumeration, 171
MouseEventArgs class, 171-172
MouseWheelEventArgs class, 171
multi-touch events
basic touch events, 177-180
explained, 176
manipulation events
adding inertia with, 183-188
enabling panning/rotating/zooming with, 182-183
explained, 180-181
ManipulationCompleted, 181
ManipulationDelta, 181
ManipulationStarted, 181
ManipulationStarting, 181
multi-touch support, 16
MultiBinding class, 410-411
multiple providers, support for
applying animations, 89
coercion, 89
determining base values, 87-88
evaluating, 89
explained, 87
validation, 89
multiple Visuals, hit testing with, 500-503
multiple-document interface (MDI), 203
MultiPoint Mouse SDK, 176
multithreaded applications, 205
MyHwndHost class, 684-686
Name keyword, 42
named elements, 434
named styles, 421-422
NamespaceDeclaration value (NodeType property), 57
namespaces
explained, 26-28
implicit .NET namespaces, 27
mapping, 26
naming elements, 42-43
Navigate method, 214-215
navigation
keyboard navigation, supporting in Win32 controls, 687-691
views, 392-393
XAML Browser applications, 228-229
navigation-based Windows applications
explained, 211-212
hyperlinks, 215-216
journal, 216-218
Navigate method, 214-215
navigation containers, 212-214
navigation events, 218-219
Page elements, 212-214
returning data from pages, 221-222
sending data to pages, 220-221
NavigationCommands class, 190
NavigationProgress event, 219
NavigationStopped event, 219
NavigationWindow class, 212-214
nearest-neighbor bitmap scaling, 310
.NET properties, binding to, 367-368
NodeType property (XAML), 57-58
None ProgressState, 246
None value (NodeType property), 58
nonprinciple axis, scaling about, 559
NonZero fill (FillRule property), 482
NoRegisteredHandler value (JumpItemRejectionReason enumeration), 244
Normal ProgressState, 246
normals, 581
Normals property (MeshGeometry3D class), 581-583
null regions, 171
Object class, 73
attributes, 25
content property, 35-36
declaring, 25
dictionaries, 37-38
explained, 24-26
lists, 36-37
naming, 42-43
positioning
content alignment, 104-105
explained, 103
flow direction, 105-106
horizontal and vertical alignment, 103-104
stretch alignment, 104
processing child elements, 40
sizing
explained, 98
explicit sizes, avoiding, 99
height and width, 98-100
margin and padding, 100-102
visibility, 102-103
transforms
applying, 106-107
combining, 113-114
explained, 106
MatrixTransform, 112-113
RotateTransform, 108-109
ScaleTransform, 109-111
SkewTransform, 112
support for, 114
TranslateTransform, 112
values type-converted to object elements, 38
ObjectDataProvider class, 401-403
objects
binding to, 369-370
instantiating via factory methods, 51-52
instantiating with non-default constructors, 51
live objects, writing to, 61-63
logical trees, 75-76
Object class, 73
visual trees, 76-80
on-demand download (XAML Browser applications), 230-231
OneTime binding, 403
OneWay binding, 403
OneWayToSource binding, 403-404
OnMnemonic method, 691
OnNoMoreTabStops method, 690
opacity masks, brushes as, 527-529
Opacity property (brushes), 527
OpacityMask property (brushes), 527-529
OpenGL, 10
opening project files in Visual Studio, 350
OR relationships (logical), 429
order of property and event processing, 26
Orientation property
ProgressBar control, 335
StackPanel, 118
WrapPanel, 120
OriginalSource property (RoutedEventArgs class), 162
blind spots, 545
compared to PerspectiveCamera class, 551-553
LookDirection property, 544-548
Position property, 543-544
UpDirection property, 548-550
Z-fighting, 545
OuterConeAngle property (PointLights), 568
OverlapPanel, 763-768
overlapping content, 677
overlapping Visuals, hit testing with, 503-505
Overlay property (TaskbarItemInfo), 247
overlays, adding to taskbar items, 247
overriding
ArrangeOverride method, 754-755
MeasureOverride method, 752-754
packageURI, 349
Padding property (FrameworkElement class), 100-102
Page elements, 212-214
PageFunction class, 221-222
pages
loose XAML pages, 231-232
Page elements, 212-214
refreshing, 217
returning data from, 221-222
sending data to, 220-221
stopping loading, 217
panels
content overflow, handling
clipping, 139-141
explained, 139
scaling, 143-147
scrolling, 141-143
custom panels
communication between parents and children, 752-755
explained, 751-752
FanCanvas, 768-772
OverlapPanel, 763-768
SimpleCanvas, 755-760
SimpleStackPanel, 760-763
DockPanel
examples, 122-125
explained, 122
interaction with child layout properties, 125
mimicking with Grid, 136
properties, 122
explained, 115-116
Grid
cell properties, 128
compared to other panels, 136
explained, 125
interaction with child layout properties, 137
interactive sizing with GridSplitter, 132-133
mimicking Canvas with, 136
mimicking DockPanel with, 136
mimicking StackPanel with, 136
sharing row/column sizes, 134-136
ShowGridLines property, 129
sizing rows/columns, 130-132
start page with Grid, 126-129
SelectiveScrollingGrid, 138-139
explained, 118
interaction with child layout properties, 119
mimicking with Grid, 136
TabPanel, 137
ToolBarOverflowPanel, 138
ToolBarPanel, 138
ToolBarTray, 138
UniformGrid, 138
Visual Studio-like panes, creating
sequential states of user interface, 147-151
VisualStudioLikePanes.xaml, 151-153
VisualStudioLikePanes.xaml.cs, 153-157
WrapPanel
examples, 121
explained, 120
interaction with child layout properties, 121-122
properties, 120
and right-to-left environments, 121
panning
enabling with multi-touch events, 182-183
with inertia, 184-185
Paragraph Blocks, 320
Parse method, 64
parsing XAML at runtime, 40-42
partial keyword, 44
partial-trust applications, 15
parts (control), 447-449
PasswordBox control, 316
path-based animations, 637
Path class, 511-512
PathGeometry class
ArcSegment, 480
BezierSegment, 480
example, 480-482
explained, 479
FillRule property, 482-483
LineSegment, 480
PolyBezierSegment, 480
PolyLineSegment, 480
PolyQuadraticBezierSegment, 480
QuadraticBezierSegment, 480
Paused ProgressState, 246
Pen class, 489-491
percentage sizing, 131
performance
cached composition
BitmapCache class, 533-535
BitmapCacheBrush class, 535
Viewport2DVisual3D support for, 591
improving rendering performance
BitmapCache class, 533-535
BitmapCacheBrush class, 535
RenderTargetBitmap class, 532-533
XAML, 71
WPF 3.5 enhancements, 16
WPF 4 enhancements, 17
persisting application state, 209-210
PerspectiveCamera class
blind spots, 545
compared to OrthographicCamera class, 551-553
LookDirection property, 544-548
Position property, 544
UpDirection property, 548-550
Z-fighting, 545
Petzold, Charles, 23
PInvoke, 251
PixelFormats enumeration, 311
device-independent pixels, 102
pixel boundaries, 17
pixel shaders, 531
Play method, 654
PlayingCard control
behavior
code-behind file, 734
final implementation, 737-739
initial implementation, 733-737
resources, 734-735
generic resources, 741-742
placing into ListBox, 742
user interface, 739-742
PointLight, 564-566
PolyBezierSegment class, 480
Polygon class, 511
Polyline class, 510
PolyLineSegment class, 480
PolyQuadraticBezierSegment class, 480
Position property (Cameras), 543-544
positioning elements
content alignment, 104-105
explained, 103
flow direction, 105-106
horizontal and vertical alignment, 103-104
stretch alignment, 104
Positions property (MeshGeometry3D class), 579
power easing functions, 637-638
PressureFactor property (StylusPoint object), 175
PreviewKeyDown event, 168
PreviewKeyUp event, 168
printing logical/visual trees, 78-79
PrintLogicalTree method, 79
PrintVisualTree method, 78
PriorityBinding class, 411
procedural code
accessing binary resources from, 349-350
animation classes
AutoReverse property, 618
BeginTime property, 616-617
DoubleAnimation, 611-612
Duration property, 614
EasingFunction property, 620
explained, 608-610
FillBehavior property, 621
From property, 614-616
IsAdditive property, 621
IsCumulative property, 621
lack of generics, 610-611
linear interpolation, 612-613
RepeatBehavior property, 618-619
reusing animations, 613
SpeedRatio property, 617
To property, 614-616
Binding object in, 363-365
compared to XAML, 24
defining and applying resources in, 359-360
embedding PropertyGrid with, 700-702
frame-based animation, 609
markup extensions in, 35
mixing XAML with
BAML (Binary Application Markup Language), 45-48
CAML (Compiled Application Markup Language), 46
compiling XAML, 43-45
generated source code, 46
loading and parsing XAML at runtime, 40-42
naming XAML elements, 42-43
procedural code inside XAML, 47
skins, 462
timer-based animation, 608
type converters in, 31
inside XAML, 47
procedural code timer-based animation, 609
ProgressBar, 335
adding to taskbars, 246
pie chart control template, 442-444, 453-455
ProgressState property (TaskbarItemInfo), 246
ProgressValue property (TaskbarItemInfo), 246
project files, opening in Visual Studio, 350
PromptBuilder class, 665-667
properties. See also specific properties
dependency properties
attached properties, 89-93
attached property providers, 92
change notification, 83-84
explained, 80-81
implementation, 81-83
property value inheritance, 85-86
support for multiple providers, 87-89
.NET properties, binding to, 367-368
order of processing, 26
Properties collection, 203
Properties collection, 203
property attributes, 25
property elements, 29-30
property paths, 277
property triggers, 83-85, 424-427, 628-629
property value inheritance, 85-86
property wrappers, 82
PropertyGrid
embedding with procedural code, 700-702
embedding with XAML, 702-703
PropertyGroupDescription class, 390
proportional sizing, 130
protecting controls from accidental usage, 727-728
pure-XAML Twitter client, 412-413
QuadraticAttenuation property (PointLights), 566
QuadraticBezierSegment class, 480
QuaternionRotation3D class, 559
QueryContinueDragEventArgs class, 173
RadialGradientBrush class, 519-520
RadioButton class, 266-268
RadiusX property
RadialGradientBrush, 519
Rectangle class, 507
RadiusY property
RadialGradientBrush, 519
Rectangle class, 507
range controls
explained, 334
ProgressBar, 335
Slider, 335-336
Range property (PointLights), 566
raw project files, opening in Visual Studio, 350
readers (XAML)
explained, 53-54
markup compatibility, 61
node loops, 56-57
NodeType property, 57-58
sample XAML content, 58-59
XAML node stream, 59-61
XamlServices class, 64-67
recent and frequent JumpPaths, 243-244
Rectangle class, 507-508
RectangleGeometry class, 479
Refresh method, 217
refreshing pages, 217
Register method, 82
rejected items, reponding to, 244
RelativeSource property (Binding object), 367
releases of WPF
future releases, 17
WPF 3.0, 14
WPF 3.5, 14-16
WPF 3.5 SP1, 15-16
WPF Toolkit, 14
removed items, reponding to, 244
RemovedByUser value (JumpItemRejectionReason enumeration), 244
RemoveHandler method, 160-161
removing Binding objects, 365
RenderAtScale property (BitmapCache class), 533
rendering
custom rendering, 499
improving rendering performance
BitmapCache class, 533-535
BitmapCacheBrush class, 535
RenderTargetBitmap class, 532-533
text, 17
TextOptions class, 312
WPF 4 enhancements, 311-312
Rendering event, 609
rendering, controlling
data templates, 378-380
explained, 375
string formatting, 375-377
value converters
Binding.DoNothing values, 385
bridging incompatible data types, 381-384
customizing data display, 385
explained, 381
RenderSize property (FrameworkElement class), 99
RenderTargetBitmap class, 532-533
RenderTransform property (FrameworkElement class), 106
RenderTransformOrigin property (UIElement class), 107
RepeatBehavior property (animation classes), 618-619
RepeatButton class, 265
ResizeBehavior property (GridSplitter), 133
ResizeDirection property (GridSplitter), 133
resolution independence, 12
Resource build action, 344-345
ResourceDictionary class, 357
ResourceDictionaryLocation parameter, 467
resources
binary resources
accessing, 345-350
defining, 344-345
explained, 343
localizing, 350-351
defined, 343
keyless resources, 422-423
logical resources
accessing directly, 360
consolidating color brushes with, 353-355
defining and applying in procedural code, 359-360
explained, 351-352
interaction with system resources, 360-361
resource lookup, 355
resources without sharing, 358
static versus dynamic resources, 355-357
for PlayingCard custom control, 734-735
responding to rejected or removed items, 244
restoring application state, 209-210
restricting style usage, 420-421
results, dialog results, 208
retained-mode graphics systems, 14, 475-476
returning data from pages, 221-222
reusing animations, 613
RichTextBox control, 316
Right property (Canvas), 116
right-handed coordinate systems, 543-544
RotateTransform, 108-109
RotateTransform3D class, 559-562
rotation
enabling with multi-touch events, 182-183
with inertia, 184-185
RotateTransform3D class, 559-562
Rotation property (ManipulationDelta class), 181
routed events
About dialog example, 162-164
adding to user controls, 731-732
attached events, 165-167
consolidating routed event handlers, 167-168
defined, 159
explained, 159-160
implementation, 160-161
RoutedEventArgs class, 162
routing strategies, 161-162
stopping, 165
RoutedEvent property (RoutedEventArgs class), 162
RoutedEventArgs class, 162
RoutedUICommand objects, 190
routing strategies, 161-162
RoutingStrategy enumeration, 161
RowDetailsVisibilityMode property (DataGrid), 297
rows (Grid)
displaying row details, 296-297
selecting, 295
sharing row/column sizes, 134-136
sizing
absolute sizing, 130
autosizing, 130
GridLength structures, 131-132
interactive sizing with GridSplitter, 132-133
percentage sizing, 131
proportional sizing, 130
rules, 405-409
Run method, 200-201
running XAML examples, 22
runtime, loading and parsing XAML at, 40-42
satellite assemblies, creating with LocBaml, 351
Save method, 64
Scale property (ManipulationDelta class), 181
ScaleTransform3D class, 557-559
ScaleX property (RotateTransform class), 109
ScaleY property (RotateTransform class), 109
scaling, 143-147
nearest-neighbor bitmap scaling, 310
about nonprinciple axis, 559
ScaleTransform3D class, 557-559
scope of typed styles, 421
scRGB color space, 514
ScrollBars, 142-143
scrolling behavior, 141-143
controlling in items controls, 280-281
ListBox control, 289
ScrollViewer control, 141-143
Section Blocks, 320
security, XAML Browser applications, 229
SelectedDatesChanged event, 339
SelectedIndex property (Selector class), 281
SelectedItem property (Selector class), 281
SelectedValue property (Selector class), 281
selecting rows/cells, 295
selection boxes (ComboBox control), customizing, 282-285
SelectionChanged event, 281, 285-286
SelectionMode property
Calendar control, 337
DataGrid, 295
ListBox, 288
SelectionUnit property (DataGrid), 295
SelectiveScrollingGrid, 138-139
Selector class, 281
selectors, data template selectors, 381
SelectVoice method, 664
SelectVoiceByHints method, 664
sending data to pages, 220-221
Separator control, 299
SetBinding method, 365
SetCurrentValue method, 89
SetOutputToDefaultAudioDevice method, 665
SetOutputToWaveFile method, 665
SetResourceReference method, 359
Setters, 419-420
Settings class, 210
ShaderEffect, 530-531
Shapes
clip art based on Shapes, 512-513
Ellipse class, 508
explained, 505-506
how they work, 509
Line class, 509-510
overuse of, 507
Path class, 511-512
Polygon class, 511
Polyline class, 510
Rectangle class, 507-508
sharing
data source with DataContext, 374-375
Grid row/column sizes, 134-136
resources without sharing, 358
styles, 418-420
ShowDialog method, 208-209
ShowDuration property (ToolTip class), 270
ShowFrequentCategory property (JumpList class), 243
ShowGridLines property (Grid), 129
ShowOnDisabled property
ContextMenuService class, 302
ToolTipService class, 271
ShowRecentCategory property (JumpList class), 243
ShutdownMode enumeration, 202
Silicon Graphics OpenGL, 10
Silverlight XAML Vocabulary Specification 2008 (MS-SLXV), 24
SimpleCanvas, 755-760
SimpleQuadraticEase class, 641
SimpleStackPanel, 760-763
SineEase function, 640
single-instance applications, 204
single-threaded apartment (STA), 199
sizing
Grid rows/columns
absolute sizing, 130
autosizing, 130
GridLength structures, 131-132
interactive sizing with GridSplitter, 132-133
percentage sizing, 131
proportional sizing, 130
sharing row/column sizes, 134-136
elements
explained, 98
explicit sizes, avoiding, 99
height and width, 98-100
margin and padding, 100-102
visibility, 102-103
SkewTransform, 112
skins
defined, 415
examples, 459-461
Light and Fluffy skin example, 463-464
malicious skins, preventing, 464-465
missing styles, troubleshooting, 461
procedural code, 462
Skip method, 63
Slider control, 335-336
snapshots of individual video frames, taking, 660
SnapsToDevicePixels property, 17, 534
Snoop, 14
SolidColorBrush class, 514
SortDescription class, 395
SortDescriptions collection, 387
SortDescriptions property
ICollectionView class, 386
ItemsCollection object, 289
SoundPlayer class, 654
SoundPlayerAction class, 654-655
Source property
MediaElement class, 656
RoutedEventArgs class, 162
SourceName property (Trigger class), 433
spaces in geometry strings, 489
spans, 325-326
SpeakAsync method, 664
SpeakAsyncCancelAll method, 664
speech recognition
converting spoken words into text, 667-670
specifying grammar with GrammarBuilder, 671-672
specifying grammar with SRGS, 670-671
Speech Recognition Grammar Specification (SRGS), 670-671
speech synthesis
explained, 664
GetInstalledVoices method, 664
PromptBuilder class, 665-667
SelectVoice method, 664
SelectVoiceByHints method, 664
SetOutputToWaveFile method, 665
SpeakAsync method, 664
Speech Synthesis Markup Language (SSML), 665-667
SpeechSynthesizer, 664
Speech Synthesis Markup Language (SSML), 665-667
SpeechRecognitionEngine class, 669-670
SpeechSynthesizer, 664
SpeedRatio property (animation classes), 617
spell checking, 315
Spinning Prize Wheel, 186-187
splash screens, 205-206
spline keyframes, 633-634
SpotLight, 564-568
SpreadMethod property (LinearGradientBrush), 517
Square line cap (Pen), 490
sRGB color space, 514
SRGS (Speech Recognition Grammar Specification), 670-671
SSML (Speech Synthesis Markup Language), 665-667
STA (single-threaded apartment), 199
StackPanel. See also SimpleStackPanel
explained, 118
interaction with child layout properties, 119
mimicking with Grid, 136
setting font properties on, 90-91
with Menu control, 300
standard Windows applications
Application class
creating applications without, 204
events, 202
explained, 199-200
Properties collection, 203
Run method, 200-201
Windows collection, 202
application state, 209-210
ClickOnce, 210-211
common dialogs, 206-207
custom dialogs, 207-208
explained, 195-196
multiple-document interface (MDI), 203
multithreaded applications, 205
retrieving command-line arguments in, 202
single-instance applications, 204
splash screens, 205-206
Window class, 196-198
Windows Installer, 210
start pages, building with Grid, 126-129
starting animations from property triggers, 628-629
StartLineCap property (Pen class), 489
StartMember value (NodeType property), 57
StartObject value (NodeType property), 57
StartPoint property (LinearGradientBrush), 516
StartupUri property (Application class), 200-201
states
control states, 449-455, 745-749
persisting and restoring, 209-210
visual states
respecting with triggers, 442-446
respecting with VSM (Visual State Manager), 447-455
STAThreadAttribute, 695
static versus dynamic resources, 355-357
StaticResource markup extension, 355-357
StatusBar control, 307-308
StopLoading method, 217
stopping
page loading, 217
routed events, 165
Storyboards
EventTriggers containing Storyboards, 621-622
Storyboards as Timelines, 629-630
TargetName property, 625-626
TargetProperty property, 622-625
StreamGeometry class, 483
Stretch alignment, 104
Stretch enumeration, 144
Stretch property
DrawingBrush class, 521
MediaElement class, 658
StretchDirection enumeration, 144
StretchDirection property (MediaElement class), 658
StringFormat property (Binding object), 375-376
strings
formatting, 375-377
representing geometries as, 487-489
Stroke objects, 317
structures, ValueSource, 88
styles
consolidating property assignments in, 417
default styles, 88
defined, 415
explained, 416-418
implicit styles, creating, 421-422
inheritance, 418
keyless resources, 422-423
missing styles, troubleshooting, 461
mixing with control templates, 456-457
named styles, 421-422
per-theme styles and templates, 466-469
restricting usage of, 420-421
Setter behavior, 419-420
sharing, 418-420
theme styles, 88
triggers
conflicting triggers, 429
data triggers, 427-428
explained, 423-424
expressing logic with, 428-430
property triggers, 424-427
respecting visual states with, 442-446
typed styles, 421-422
stylus events, 174-176
StylusButtonEventArgs instance, 176
StylusButtons property (StylusDevice class), 175
StylusDevice class, 174-175
StylusDownEventArgs instance, 176
StylusEventArgs class, 176
StylusPoint objects, 175
StylusSystemGestureEventArgs instance, 176
Surface Toolkit for Windows Touch, 188
system resources, interaction with logical resources, 360-361
SystemKey property (KeyEventArgs class), 168
SystemSounds class, 654
TabControl control, 291-292
TabInto method, 688
Table Blocks, 320
TabletDevice property (StylusDevice class), 175
TabPanel, 137
TargetName property (Storyboards), 625-626
TargetNullValue property (Binding object), 366
TargetProperty property (Storyboards), 622-625
TargetType property
ControlTemplate class, 434-435
Style class, 420-421
taskbar, customizing
explained, 245-246
taskbar item overlays, 247
taskbar item progress bars, 246
thumb buttons, 248-249
thumbnail content, 247
TaskDialogs, 253-256
customizing behavior of, 237-240
example, 235
explained, 234
TemplateBindingExtension class, 435-437
templated parent properties, respecting, 435-439
Content property (ContentControl class), 435-437
hijacking existing properties for new purposes, 441
other properties, 440
templates
control templates
editing, 457-458
mixing with styles, 456-457
named elements, 434
resuability of, 438-440
simple control template, 431-432
target type, restricting, 434-435
templated parent properties, respecting, 435-441
other properties, 438-439
triggers, 432-434
visual states, respecting with triggers, 442-446
visual states, respecting with VSM (Visual State Manager), 447-455
DataTemplates, 378-380
defined, 415
explained, 430-431
HierarchicalDataTemplate, 399-400
per-theme styles and templates, 466-469
template selectors, 381
Windows themes, 470
temporarily canceling data binding, 385
testing
3D hit testing, 592-593
input hit testing
explained, 499
InputHitTest method, 513
visual hit testing
callback methods, 505
explained, 499
simple hit testing, 499-500
with multiple Visuals, 500-503
with overlapping Visuals, 503-505
text
converting spoken words into, 667-670
InkCanvas class, 316-318
PasswordBox control, 316
RichTextBox control, 316
text-to-speech
explained, 664
GetInstalledVoices method, 664
PromptBuilder class, 665-667
SelectVoice method, 664
SelectVoiceByHints method, 664
SetOutputToWaveFile method, 665
SpeakAsync method, 664
Speech Synthesis Markup Language (SSML), 665-667
SpeechSynthesizer, 664
TextBlock control
explained, 313-314
explicit versus implicit runs, 314
properties, 313
support for multiple lines of text, 315
whitespace, 314
TextBox control, 315
TextOptions class, 312
explained, 664
GetInstalledVoices method, 664
PromptBuilder class, 665-667
SelectVoice method, 664
SelectVoiceByHints method, 664
SetOutputToWaveFile method, 665
SpeakAsync method, 664
Speech Synthesis Markup Language (SSML), 665-667
SpeechSynthesizer, 664
TextBlock control
explained, 313-314
explicit versus implicit runs, 314
properties, 313
support for multiple lines of text, 315
whitespace, 314
TextBox control, 315
TextElement class, 319-320
Blocks
AnchoredBlock class, 326-327
BlockUIContainer, 321
List, 320
Paragraph, 320
sample code listing, 321-324
Section, 320
Table, 320
Inlines
AnchoredBlock, 326-327
defined, 324-325
InlineUIContainer, 329
LineBreak, 327
Span, 325-326
TextFormattingMode property (TextOptions), 312
TextHintingMode property (TextOptions), 312
TextOptions class, 312
TextRenderingMode property (TextOptions), 312
texture coordinates, 584
TextureCoordinates property (MeshGeometry3D class), 583
theme dictionaries, 466
theme styles, 88
ThemeDictionaryExtension, 468
ThemeInfoAttribute, 467-468
themes
generic dictionaries, 467
per-theme styles and templates, 466-469
system colors, fonts, and parameters, 465-466
theme dictionaries, 466
Thickness class, 100-102
ThicknessConverter type converter, 102
thumb buttons (taskbar), adding, 248-249
ThumbButtonInfo property (TaskbarItemInfo), 248-249
thumbnail content (taskbar), customizing, 247
ThumbnailClipMargin property (TaskbarItemInfo), 247
tile brushes
DrawingBrush class, 520-524
ImageBrush class, 524-525
VisualBrush class, 525-527
TileMode enumeration, 523
TileMode property (DrawingBrush class), 521-523
Timelines, 629-630
timer-based animation, 608-609
To property (animation classes), 614-616
ToggleButton class, 265-266
ToolBar control, 304-306
ToolBarOverflowPanel, 138
ToolBarPanel, 138
ToolTip class, 269-271
ToolTipService class, 271
Top property (Canvas), 116
touch events, 177-180
TouchDevice property (TouchEventArgs class), 177
TouchDown event, 178-180
TouchEventArgs class, 177
TouchMove event, 178-180
TouchUp event, 178-180
TraceSource object, 384
Transform method, 65
Transform property (Cameras), 549
Transform3Ds
combining, 562
explained, 554-555
house drawing example, 555-556
MatrixTransform3D class, 554, 562
RotateTransform3D class, 554, 559-562
ScaleTransform3D class, 554, 557-559
Transform3DGroup class, 554
TranslateTransform3D class, 554-557
TransformConverter type converter, 113
applying, 106-107
clipping and, 141
combining, 113-114
explained, 106
MatrixTransform, 112-113
RotateTransform, 108-109
ScaleTransform, 109-111
SkewTransform, 112
support for, 114
Transform3Ds
combining, 562
explained, 554-555
house drawing example, 555-556
MatrixTransform3D class, 554, 562
RotateTransform3D class, 554, 559-562
ScaleTransform3D class, 554, 557-559
Transform3DGroup class, 554
TranslateTransform3D class, 554-557
TranslateTransform, 112
TransformToAncestor method, 596-605
TransformToDescendant method, 600-605
transitions (animation), 647-651
Transitions property (VisualStateGroup class), 455
TranslateAccelerator method, 689-691
TranslateTransform, 112
TranslateTransform3D class, 556-557
Translation property (ManipulationDelta class), 181
transparent colors, 520
transparent regions and mouse events, 171
logical trees, 75-76
visual trees, 76-80
TreeView control, 302-304
TreeViewItem class, 303-304
TriangleIndices property (MeshGeometry3D class), 580-581
Trigger class. See triggers
TriggerBase class, 85
conflicting triggers, 429
event triggers, 84
explained, 423-427
expressing logic with, 428
logical AND, 429-430
logical OR, 429
in control templates, 432-434
property triggers, 83-85, 424-427
respecting visual states with, 442-446
Triggers collection, 85
Triggers property (FrameworkElement class), 85
troubleshooting
data binding, 384
missing styles, 461
TryFindResource method, 359
tunneling, 161
turning off type conversion, 50
Twitter, pure-XAML Twitter client, 412-413
TwoWay binding, 403
type converters
BrushConverter, 32
explained, 30-31
finding, 32
FontSizeConverter, 32
GridLengthConverter, 131
ImageSourceConverter, 309
LengthConverter, 102
in procedural code, 31
ThicknessConverter, 102
TransformConverter, 113
turning off type conversion, 50
values type-converted to object elements, 38
typed styles, 421-422
UI Automation, supporting in custom controls, 749-750
UICulture element, 350
Uid directive, 351
UIElement class
binding to, 370
explained, 74
IsKeyboardFocused property, 170
IsMouseDirectlyOver property, 171
RenderTransformOrigin property, 107
ContainerUIElement3D, 590
explained, 74
ModelUIElement3D, 588-590
uniform scale, 557
UniformGrid, 138
unmanaged code, mixing with managed code, 682
UpdateLayout method, 100
UpdateSourceExceptionFilter property (Binding object), 408
UpdateSourceTrigger enumeration, 404-405
UpdateSourceTrigger property (Binding object), 404
UpDirection property (Cameras), 548-550
URIs
packageURI, 349
URIs for accessing binary resources, 346-347
usage context, 375
UseLayoutRounding property, 17
user controls, creating
behavior, 725-727
dependency properties, 728-731
explained, 721-722
protecting controls from accidental usage, 727-728
routed events, 731-732
user controls versus custom controls, 722
user interfaces, 723-725
creating for PlayingCard custom control, 739-742
creating for user controls, 723-725
marking with localization IDs, 351
USER subsystems, 10
ValidateValueCallback delegate, 89
validation rules, 405-409
ValidationRules property (Binding object), 406
value converters
Binding.DoNothing values, 385
bridging incompatible data types, 381-384
customizing data display, 385
explained, 381
temporarily canceling data binding, 385
ValueMinMaxToIsLargeArcConverter, 445-446
ValueMinMaxToPointConverter, 445-446
Value value (NodeType property), 57
ValueMinMaxToIsLargeArcConverter, 445-446
ValueMinMaxToPointConverter, 445-446
ValueSource structure, 88
variables, HwndSource, 697-698
verbosity of XAML, 71
versions of WPF
future releases, 17
WPF 3.0, 14
WPF 3.5, 14-16
WPF 3.5 SP1, 15-16
WPF Toolkit, 14
VerticalAlignment property (FrameworkElement class), 103-105
video support
controlling underlying media, 661-662
embedded resources, 663
explained, 658
MediaElement, 658-660
taking snapshots of individual video frames, 660
Windows Media Player, 658
VideoDrawing class, 476
Viewbox class, 144-147
Viewbox property (DrawingBrush class), 523-524
Viewport2DVisual3D class, 15, 590-591
Viewport3D class, 593-596
Viewport3DVisual class, 596
views
customizing collection views
creating new views, 394-396
explained, 386
filtering, 392
grouping, 388-391
navigating, 392-393
sorting, 386-388
TreeView control, 302-304
viewSource_Filter method, 395
VirtualizingPanel class, 120
VirtualizingStackPanel, 120, 279
Visibility property (FrameworkElement class), 102-103
Visible value (Visibility enumeration), 102
Visual class, 80
explained, 74
TransformToAncestor method, 596-600
visual effects, 529-531
visual hit testing
callback methods, 505
explained, 499
simple hit testing, 499-500
with multiple Visuals, 500-503
with overlapping Visuals, 503-505
Visual State Manager (VSM), 17
animations and
Button ControlTemplate with VisualStates, 643-646
transitions, 647-651
respecting visual states with
control parts, 447-449
control states, 449-455
visual states
respecting with triggers, 442-446
respecting with VSM (Visual State Manager)
control parts, 447-449
control states, 449-455
Visual Studio debugger, 236
Visual Studio-like panes, creating
sequential states of user interface, 147-151
VisualStudioLikePanes.xaml, 151-153
VisualStudioLikePanes.xaml.cs, 153-157
Visual3Ds
ModelVisual3D class, 587-588
TransformToAncestor method, 600-605
TransformToDescendant method, 600-605
UIElement3D class, 588
ContainerUIElement3D, 590
ModelUIElement3D, 588-590
VisualBrush class, 525-527
VisualChildrenCount method, 497-498
Visuals
custom rendering, 499
displaying on screen, 496-498
DrawingContext methods, 494
DrawingVisuals
explained, 493
filling with content, 493-496
explained, 493
visual hit testing
callback methods, 505
explained, 499
simple hit testing, 499-500
with multiple Visuals, 500-503
with overlapping Visuals, 503-505
VisualStateGroup class, 455
VisualStateManager. See Visual State Manager
VisualStudioLikePanes.xaml file, 151-153
VisualStudioLikePanes.xaml.cs file, 153-157
VisualTransition objects, 647-651
VisualTreeHelper class, 77
vshost32.exe, 236
VSM (Visual State Manager), 17
animations and
Button ControlTemplate with VisualStates, 643-646
transitions, 647-651
respecting visual states with
control parts, 447-449
control states, 449-455
Webcam control (Win32)
HostingWin32.cpp file, 685-687
Webcam.cpp file, 678-681
Webcam.h file, 678
Window1.h file, 683-684
Webcam.cpp file, 679-681
Webcam.h file, 678
whitespace, TextBlock control, 314
Width property (FrameworkElement class), 98-100
Win32 controls, WPF interoperability
explained, 677
HwndSource class, 692-695
keyboard navigation, 687-691
launching modal dialogs, 692, 699
layout, 696-699
Webcam control, 678-687
winding order (mesh), 579-580
Window class, 196-198
Window1.h file, 683
Window1.xaml file, 717
Window1.xaml.cs file, 716
WindowHostingVisual.cs file, 495-497
WindowInteropHelper class, 708
Windows 7 user interface features
Aero Glass, 249-253
Jump Lists
and Visual Studio debugger, 236
associating with applications, 234
explained, 233-234
JumpPaths, 241-244
JumpTasks, 234-240
taskbar item customizations
explained, 245-246
taskbar item overlays, 247
taskbar item progress bars, 246
thumb buttons, 248-249
thumbnail content, 247
TaskDialogs, 253-256
WPF 4 support for, 16
Windows applications
multiple-document interface (MDI), 203
navigation-based Windows applications
explained, 211-212
hyperlinks, 215-216
journal, 216-218
Navigate method, 214-215
navigation containers, 212-214
navigation events, 218-219
Page elements, 212-214
returning data from pages, 221-222
sending data to pages, 220-221
single-instance applications, 204
standard Windows applications
Application class, 199-204
application state, 209-210
ClickOnce, 210-211
common dialogs, 206-207
custom dialogs, 207-208
explained, 195-196
multithreaded applications, 205
retrieving command-line arguments in, 202
splash screens, 205-206
Window class, 196-198
Windows Installer, 210
Windows collection, 202
Windows Forms controls, WPF interoperability, 10
converting between two representatives, 707-708
ElementHost class, 704-706
explained, 699-700
launching modal dialogs, 703, 708
PropertyGrid, 700-703
Windows Installer, 210
Windows Media Player, 658
Windows themes, 470
Windows XP, WPF differences on, 18
WindowsFormsHost class, 702
WorkingDirectory property (JumpTask), 238
WPF 3.0, 14
WPF 3.5, 14-16
WPF 3.5 SP1, 15-16
WPF Toolkit, 14
WPF XAML Vocabulary Specification 2006 (MS-WPFXV), 24
WrapPanel
examples, 121
explained, 120
interaction with child layout properties, 121-122
properties, 120
and right-to-left environments, 121
WriteableBitmap class, 15
writers (XAML)
explained, 53-54
node loops, 56-57
writing to live objects, 61-63
writing to XML, 63-64
XamlServices class, 64-67
writing
easing functions, 640-642
validation rules, 406-407
X property
StylusPoint object, 175
TranslateTransform class, 112
x:Array keyword, 70
x:AsyncRecords keyword, 67
x:Boolean keyword, 67
x:Byte keyword, 67
x:Char keyword, 67
x:ClassAttributes keyword, 68
x:ClassModifier keyword, 68
x:Code keyword, 68
x:ConnectionId keyword, 68
x:Decimal keyword, 68
x:Double keyword, 68
x:FactoryMethod keyword, 51-52, 68
x:FieldModifier keyword, 68
x:Int16 keyword, 68
x:Int32 keyword, 68
x:Int64 keyword, 68
x:Key keyword, 68
x:Null keyword, 70
x:Object keyword, 68
x:Single keyword, 69
x:Static keyword, 70
x:String keyword, 69
x:Subclass keyword, 69
x:SynchronousMode keyword, 69
x:TimeSpan keyword, 69
x:Type keyword, 70
x:TypeArguments keyword, 69
x:Uid keyword, 69
x:Uri keyword, 69
x:XData keyword, 69
XAML (Extensible Application Markup Language)
{ } escape sequence, 377
accessing binary resources from, 345-348
advantages of, 22-24
animation with EventTriggers/Storyboards
explained, 621-622
starting animations from property triggers, 628-629
Storyboards as Timelines, 629-630
TargetName property, 625-626
TargetProperty property, 622-625
BAML (Binary Application Markup Language)
decompiling back into XAML, 47-48
defined, 45
Binding object in, 365-367
CAML (Compiled Application Markup Language), 46
common complaints about, 70-71
compiling, 43-45
defined, 23-24
embedding PropertyGrid with, 702-703
extensibility, 39
factoring, 357
generated source code, 46
keywords, 67-70
loading and parsing at runtime, 40-42
loose XAML pages, 231-232
markup extensions
explained, 32-35
in procedural code, 35
parameters, 33
namespaces
explained, 26-28
implicit .NET namespaces, 27
mapping, 26
object elements
attributes, 25
content property, 35-36
declaring, 25
dictionaries, 37-38
explained, 24-26
lists, 36-37
naming, 42-43
processing child elements, 40
values type-converted to object elements, 38
order of property and event processing, 26
procedural code inside, 47
property elements, 29-30
pure-XAML Twitter client, 412-413
readers
explained, 53-54
markup compatibility, 61
node loops, 56-57
NodeType property, 57-58
sample XAML content, 58-59
XAML node stream, 59-61
XamlServices class, 64-67
running XAML examples, 22
specifications, 24
type converters
BrushConverter, 32
explained, 30-31
finding, 32
FontSizeConverter, 32
in procedural code, 31
values type-converted to object elements, 38
writers
explained, 53-54
node loops, 56-57
writing to live objects, 61-63
writing to XML, 63-64
XamlServices class, 64-67
XAML Browser Applications (XBAPs), 15
ClickOnce caching, 226
deployment, 229
explained, 224-226
full-trust XAML Browser applications, 228
integrated navigation, 228-229
limitations, 226-227
on-demand download, 230-231
security, 229
XAML2009
built-in data types, 50
dictionary keys, 50
event handler flexibility, 52
explained, 48-49
full generics support, 49
object instantiation via factory methods, 51-52
object instantiation with non-default constructors, 51
properties, defining, 53
XAML Browser Applications (XBAPs)
ClickOnce caching, 226
deployment, 229
explained, 224-226
full-trust XAML Browser applications, 228
integrated navigation, 228-229
limitations, 226-227
on-demand download, 230-231
security, 229
XAML Cruncher, 23
XAML Object Mapping Specification 2006 (MS-XAML), 24
XAML2009
built-in data types, 50
dictionary keys, 50
event handler flexibility, 52
explained, 48-49
full generics support, 49
object instantiation via factory methods, 51-52
object instantiation with non-default constructors, 51
properties, defining, 53
XamlBackgroundReader class, 53
XamlMember class, 58
XamlObjectReader class, 53
XamlObjectWriter class, 54
XamlObjectWriterSettings.PreferUnconvertedDictionaryKeys property, 50
XamlPad, 23
XAMLPAD2009, 22-23
XamlReader class
explained, 53-54
Load method, 40-41
LoadAsync method, 41
XamlServices class, 64-67
XamlType class, 58
XamlXmlReader class, 53-56
markup compatibility, 61
sample XAML content, 58-59
XAML node stream, 59-61
XamlXmlWriter class, 54
XBAPs. See XAML Browser Applications
XML, writing to, 63-64
XML Paper Specification (XPS), 319
XML Path Language (XPath), 397
xml:lang attibute, 67
xml:space attribute, 67
XmlDataProvider class, 397-401
XNA Framework, 11
XPath (XML Path Language), 397
XPS (XML Paper Specification), 319
Y property
StylusPoint object, 175
TranslateTransform class, 112
Z order, 117-118
Z-fighting, 545
zooming
enabling with multi-touch events, 182-183
with inertia, 184-185