contents


preface
acknowledgments
about this book
about the cover illustration



Part 1  Past, present, and future


1  The road to Avalon (WPF)
1.1 The past and the present
Why Windows drawing is the way it is
How we currently create Windows UIs
Why the web is the way it is
How UI is created on the web
1.2 Why Avalon/WPF
Taking advantage of modern hardware
Using modern software design
Separating presentation logic from presentation
Making it simpler to code GUIs
1.3 Creating UI using WPF
Defining WPF UI with XAML
Defining WPF UI through code
Defining WPF UI with tools
Who does the drawing
Pixels versus vectors
1.4 Summary
2  Getting started with WPF and Visual Studio 2008
2.1 Your grandpa’s Hello, World!
Adding a button and button-handler to the window
Running Hello, World!
The TextBlock control
2.2 The application definition
Defining application startup in XAML
Why define the application in XAML?
2.3 A tour of WPF in Visual Studio 2008
The XAML designer
The Properties grid
Selection controls in Visual Studio
The Document Outline
2.4 Summary
3  WPF from 723 feet
3.1 Where does WPF fit in Windows?
Red bits and green bits
Silverlight
3.2 Framework services
Base services
Media services
User interface services
Document services
3.3 Necessary and useful tools
Microsoft Expression family
Visual Studio
Other tools
3.4 Summary

Part 2  The basics


4  Working with layouts
4.1 The idea behind layout panels
4.2 The Canvas layout
Converting a Grid layout to a Canvas layout by modifying the XAML
Adding a Canvas to an existing layout
Using attached properties
Setting up a Canvas programmatically
4.3 The StackPanel layout
Adding scrolling support
The Expander control
4.4 The DockPanel layout
Defining a DockPanel in XAML
Setting up a DockPanel programmatically
4.5 The WrapPanel layout
4.6 Other layout options
Specialized layout panels
The FlowDocument
4.7 Summary
5  The Grid panel
5.1 Getting started with the Grid layout panel
Modifying the Grid
Grid specific properties
5.2 Using the Grid layout to build a calculator UI
Planning the calculator
Laying out the calculator
Tweaking appearance
5.3 The Grid and localization
5.4 UniformGrid
5.5 Making the calculator work
Handling operations
Genericizing the handlers
5.6 Summary
6  Resources, styles, control templates, and themes
6.1 Resources
Using standalone resource dictionaries
Using resources from code
Dynamic resources
6.2 Styles
Styles based on other styles
Implicitly applying styles
6.3 Control templates
Creating a control template
ContentPresenters
Template binding
Triggers
6.4 Themes
Using a specific theme
Changing themes from code
6.5 Summary
7  Events
7.1 Routed events
Bubbling events
Tunneling events
7.2 Events from code
handledEventsToo
Class events
7.3 Summary
8  Oooh, shiny!
8.1 Glass buttons
Styling the text
Adding glow when over buttons
Handling the button click
8.2 Adding some simple animation
Animating button glow
Animating a color
8.3 Reflections
8.4 Transforms
8.5 Summary

Part 3  Application development


9  Laying out a more complex application
9.1 Creating the Desktop Wiki Project
9.2 Nesting layouts
Preparing the layout for menus and toolbars
Adding menubars, statusbars, and toolbars...
9.3 Nested layouts
Adding the first Grid
Adding the second Grid
Using a StackPanel and Expander as navigation aids
9.4 Summary
10  Commands
10.1 A brief history of commands
Windows Forms and simple event handlers
Son of MFC
10.2 The WPF approach
The Command pattern
WPF commands
10.3 Using the built-in system commands
ApplicationCommands
NavigationCommands
EditingCommands
Component and media commands
10.4 Handling commands
Handling a built-in command
Creating a custom command
Shortcuts and gestures
10.5 Command routing
10.6 A cleaner custom command implementation
Implementing a RoutedUICommand
Adding a CommandBinding
10.7 Summary
11  Data binding with WPF
11.1 WPF data binding
11.2 ProcessMonitor: A simple binding example
Binding Data with XAML
Binding in code
Binding notation and options
11.3 Binding to XML
Creating the CVE Viewer application
Binding controls to XML
XPath binding notation
Path versus XPath
Understanding and using DataContexts
Master-Detail Binding
11.4 Binding to ADO.NET database objects
Creating a bookmark utility
Creating the simple DAL
Laying out the UI and creating data bindings
11.5 Binding to business objects
Creating a WikiPage business object
ObservableCollection
Create a model façade
Wiring business objects to presentation objects
11.6 Binding to LINQ data
11.7 Summary
12  Advanced data templates and binding
12.1 Data converters
Formatting bound data with StringFormat
A number to formatted string data converter
Converter parameters
12.2 DataTriggers
12.3 CollectionViewSource
Sorting with CollectionViewSource
Programatically sorting with CollectionViewSource
Filtering with CollectionViewSource
12.4 Conditional templates
A more involved template
Conditionally using a template
Templates based on type
12.5 Validators
The ExceptionValidationRule
Custom ErrorTemplates
Custom validation rules
12.6 Model-View-ViewModel
12.7 Advanced binding capabilities
Hierarchical binding
MultiBinding
PriorityBinding
12.8 Summary
13  Custom controls
13.1 Composing new user controls
Building a LinkLabel control
Testing the LinkLabel UserControl
13.2 Building custom controls
Building a control library
Create the new custom control
Create the default template for the control
Testing the control
Customizing a custom control with a template
13.3 Summary
14  Drawing
14.1 Drawing with Shapes
Shapes in XAML
Stupid shape tricks
14.2 Creating the graphing control
Building the GraphHolder control
Graphing using shapes
Catching clicks
The downside of Shapes
14.3 Drawing with direct rendering
Recreating the graph control
Pluses and minuses of direct rendering
14.4 Drawing with Visuals
Control for display Visuals
Hit testing with Visuals
Adding labels to our graph
14.5 Drawings and Geometries
GeometryDrawing
Using Drawings
14.6 Summary
15  Drawing in 3D
15.1 Lights, camera...
Models
Lights
Cameras
15.2 Graphing in 3D
15.3 3D Transforms
A 3D Transform in XAML
A 3D Transform in code
15.4 Summary

Part 4  The last mile


16  Building a navigation application
16.1 When and where to use navigation applications
16.2 Creating a basic navigation application
Adding some navigation
Implementing dictionary lookup
Navigating programmatically
16.3 Page functions
Creating a Page function
Calling a page function
16.4 Summary
17  WPF and browsers: XBAP, ClickOnce, and Silverlight
17.1 Building an XBAP
XBAP security
Deploying an XBAP
When to use XBAP
17.2 Using ClickOnce
Deploying a WPF application via ClickOnce
When to use ClickOnce
17.3 Using Silverlight
17.4 Summary
18  Printing, documents, and XPS
18.1 Printing flow documents
Setting up to print
Customizing the output
Printing asynchronously
18.2 Printing FixedDocuments
Adding some FlowDocument content to our FixedDocument
Matching resolution
Printing Visuals
18.3 XPS
Saving an XPS document to a file
The problem with images...
18.4 Summary
19  Transition effects
19.1 Building the World Browser application
The DictionaryLookup class
Working with the Application object
Our WorldListView user control
Populating the country list
19.2 Adding a simple transition
19.3 Building a generic transition control
Creating the transition control
Using the transition control
Defining a ControlTemplate for our control
Using the ABSwitcher
19.4 Adding some interesting transition effects
The fade effect
Wipe effect
Adding a selector for effects
19.5 Summary
20  Interoperability
20.1 Using Windows Forms controls in WPF
Using the Windows Forms DateTimePicker in WPF
Enabling Windows themes for Windows Forms control
What you can’t do with embedded Windows Forms controls
Using your own Windows Forms controls
Popping up Windows Forms dialogs
20.2 Embedding ActiveX and C++ in WPF
Embedding ActiveX controls in WPF
Embedding C++ controls in WPF
20.3 Using WPF in Windows Forms
Using a WPF control inside of Windows Forms
Popping up WPF dialogs
20.4 Summary
21  Threading
21.1 Moving slow work into a background thread
21.2 Asynchronous calls
21.3 Timers
21.4 Summary


index