售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Windows Presentation Foundation 4.5 Cookbook
Table of Contents
Windows Presentation Foundation 4.5 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Foundations
Introduction
XAML
XAML and compilation
Dependency properties
Creating custom type instances in XAML
Getting ready
How to do it...
How it works...
There's more...
Creating a dependency property
Getting ready
How to do it...
How it works...
There's more...
Property value inheritance
Why "dependency"?
Dependency property levels
Using an attached property
Getting ready
How to do it...
How it works...
There's more...
Why an attached property?
Does the declaring type "own" the property?
See also
Creating an attached property
Getting ready
How to do it...
How it works...
There's more...
Reusing existing attached properties
See also
Accessing a static property from XAML
Getting ready
How to do it...
How it works...
There's more...
Creating a custom markup extension
Getting ready
How to do it...
How it works...
There's more...
Don't go overboard
Handling routed events
Getting ready
How to do it...
How it works...
There's more...
Stopping bubbling or tunneling
Attached events
2. Resources
Introduction
Using logical resources
Getting ready
How to do it...
How it works...
There's more...
Adding or deleting resources dynamically
Modifying resources
Resources that use other resources
Non-shared resources
Other locations for resources
Dynamically binding to a logical resource
Getting ready
How to do it...
How it works...
There's more...
Using user-selected colors and fonts
Getting ready
How to do it...
How it works...
There's more...
Using binary resources
Getting ready
How to do it...
How it works...
There's more...
Embedded Resource
Accessing binary resources in code
Getting ready
How to do it...
How it works...
There's more...
Accessing binary resources from another assembly
Getting ready
How to do it...
How it works...
There's more...
Managing logical resources
Getting ready
How to do it...
How it works...
There's more...
Duplicated keys
3. Layout and Panels
Introduction
The layout process
Coordinates systems in WPF
Creating a table-like user interface
Getting ready
How to do it...
How it works...
There's more...
Shared row/column size
Placement in the same cell
The power of the Grid
Adding rows/columns dynamically
The UniformGrid
Dynamically sizing grid rows/columns
Getting ready
How to do it...
How it works...
There's more...
Creating a scrollable user interface
Getting ready
How to do it...
How it works...
There's more...
Creating a border around panels and elements
Getting ready
How to do it...
How it works...
Placing elements in exact positions
Getting ready
How to do it...
How it works...
There's more...
Canvas has no background
Canvas is not limited to its bounds
Adding/removing elements to a panel dynamically
Getting ready
How to do it...
How it works...
Creating a tabbed user interface
Getting ready
How to do it...
How it works...
There's more...
Implementing drag-and-drop
Getting ready
How to do it...
How it works...
There's more...
Built-in drag-and-drop
Drag-and-drop to other applications
4. Using Standard Controls
Introduction
Working with text
Getting ready
How to do it...
How it works...
There's more...
Using content controls
Getting ready
How to do it...
How it works...
There's more...
Headered content controls
See also
Displaying images
Getting ready
How to do it...
How it works...
There's more...
See also
Creating tooltips
Getting ready
How to do it...
How it works...
There's more...
Deeper tooltip customization
Realistic tooltips
Creating a list of items
Getting ready
How to do it…
How it works...
There's more...
Creating a standard menu
Getting ready
How to do it…
How it works...
There's more...
Other MenuItem properties and events
Creating a context menu
Getting ready
How to do it…
How it works...
There's more...
Selecting options with checkboxes and radio buttons
Getting ready
How to do it…
How it works...
Manipulating tab order and focus
Getting ready
How to do it…
How it works...
There's more...
Keyboard focus versus logical focus
5. Application and Windows
Introduction
Creating a window
Getting ready
How to do it...
How it works...
There's more...
Selecting the startup window dynamically
Accessing command line arguments
Creating a dialog box
Getting ready
How to do it...
How it works...
There's more...
Modeless dialogs
Using the common dialog boxes
Getting ready
How to do it...
How it works...
There's more...
What about colors and fonts?
The Windows API Code Pack
Creating ownership between windows
Getting ready
How to do it...
How it works...
There's more...
Creating a custom shaped window
Getting ready
How to do it...
How it works...
There's more...
What about reusability?
Creating a single instance application
Getting ready
How to do it...
How it works...
There's more...
Handling an unhandled exception
Getting ready
How to do it...
How it works...
There's more...
6. Data Binding
Introduction
Element to element binding
Getting ready
How to do it...
How it works...
There's more...
Binding mode
Update source trigger
Updating the source or target manually
Binding to a single object
Getting ready
How to do it...
How it works...
There's more...
When bindings fail
Other ways of getting a source binding object
Implementing INotifyPropertyChanged
Implementing SetProperty with Visual Studio 2012 and C# 5.0
Binding to a collection
Getting ready
How to do it...
How it works...
There's more...
Synchronizing selected items
Data binding and the Items property are mutually exclusive
What about "real" data?
Using data templates
Getting ready
How to do it...
How it works...
There's more...
Data type based data templates
Data template selectors
Using value converters
Getting ready
How to do it...
How it works...
There's more...
Using converters for debugging
Formatting strings
Customizing with data triggers
Creating a master-detail view
Getting ready
How to do it...
How it works...
There's more...
A simpler selected item binding
Sorting and filtering bound collections
Getting ready
How to do it...
How it works...
There's more...
More features of ICollectionView
Live shaping
Grouping bound collections
Getting ready
How to do it...
How it works...
There's more...
Grouping by a non-property
See also
Binding to multiple properties
Getting ready
How to do it...
How it works...
There's more...
Binding hierarchical data to a TreeView
Getting ready
How to do it...
How it works...
There's more...
Presenting data in a grid
Getting ready
How to do it...
How it works...
There's more...
Editing with a template-based column
Selecting, resizing, and sorting
Other customization options
Validating data
Getting ready
How to do it...
How it works...
There's more...
Custom validation rules
Custom error template
Using data annotations
7. Commands and MVVM
Introduction
Using routed commands
Getting ready
How to do it...
How it works...
There's more...
Built-in implementations
Command sources
Alternative ICommand implementations
Implementing a basic MVVM application
Getting ready
How to do it...
How it works...
There's more...
Implementing ICommand
Blendability
Building a simple MVVM framework
Getting ready
How to do it...
How it works...
There's more...
Non-ICommandSource elements and other events
What about Prism?
Building a complete MVVM style application
Getting ready
How to do it...
How it works...
There's more...
MVVM implementations
Creating an undo/redo system
Getting ready
How to do it...
How it works...
8. Styles, Triggers, and Control Templates
Introduction
Creating and using styles
Getting ready
How to do it...
How it works...
There's more...
Style inheritance
Other places to set styles
Applying a style automatically
Getting ready
How to do it...
How it works...
There's more...
Creating a property trigger
Getting ready
How to do it...
How it works...
There's more...
Trigger limitations
When to use triggers
Other locations of triggers
Trigger priorities
See also
Using data triggers
Getting ready
How to do it...
How it works...
Creating an event trigger
Getting ready
How to do it...
How it works...
There's more...
Creating a multi trigger
Getting ready
How to do it...
How it works...
There's more...
Using behaviors
Getting ready
How to do it...
How it works...
There's more...
Custom behaviors
Replacing the control template of a progress bar
Getting ready
How to do it...
How it works...
There's more...
What about the control's properties?
Combining a control template with a style
Extending a template with attached properties
Can we replace just part of a template?
What about the Visual State Manager?
Replacing the control template of a scroll bar
Getting ready
How to do it...
How it works...
Customizing selection in a Selector control
Getting ready
How to do it...
How it works...
There's more...
9. Graphics and Animation
Introduction
Creating a custom shape
Getting ready
How to do it...
How it works...
There's more...
Geometries
Built-in shapes
Shapes versus geometries
Applying transforms on elements
Getting ready
How to do it...
How it works...
There's more...
Other uses for transforms
Manipulating a bitmap programmatically
Getting ready
How to do it...
How it works...
There's more...
How about higher-level access to WriteableBitmap?
See also
Creating adorners
Getting ready
How to do it...
How it works...
There's more...
Creating property-based animations
Getting ready
How to do it...
How it works...
There's more...
Alternative way to specify the animation property
More on storyboards
Animations with Expression Blend
Should I always use animations?
Creating path-based animations
Getting ready
How to do it...
How it works...
There's more...
Animation performance
Creating custom animations
Getting ready
How to do it...
How it works...
Adding animation easing to animations
Getting ready
How to do it...
How it works...
There's more...
Using custom effects with pixel shaders
Getting ready
How to do it...
How it works...
There's more...
Using the built-in effects
Other shader types
What about the BitmapEffect class and its derivatives?
10. Custom Elements
Introduction
Creating a user control
Getting ready
How to do it...
How it works...
There's more...
Optimizing converters
Adding a tunneling event
Handling standard commands in a user control
Getting ready
How to do it...
How it works...
There's more...
Creating a custom (templated) control
Getting ready
How to do it...
How it works...
There's more...
Other things to set in code
What is that Generic.xaml?
Refactoring of Generic.xaml
Customizing a default template of custom control
Getting ready
How to do it...
How it works...
Creating a custom panel
Getting ready
How to do it...
How it works...
There's more...
Where are custom panels used?
Creating a lightweight custom element
Getting ready
How to do it...
How it works...
There's more...
Dependency property ownership
More DrawingContext
11. Threading
Introduction
Updating the UI from a non-UI thread
Getting ready
How to do it...
How it works...
There's more...
Dispatcher alternative
Dispatcher enhancements in WPF 4.5
More Dispatcher
What about data binding?
Adding cancelation support
Getting ready
How to do it...
How it works...
There's more...
Never cancel by aborting a thread
Using the BackgroundWorker component
Getting ready
How to do it...
How it works...
There's more...
Did we really have to pass the argument to RunWorkerAsync?
What about the Task Parallel Library?
Adding cancellation and progress with BackgroundWorker
Getting ready
How to do it...
How it works...
There's more...
What about Parallel.For?
Using a timer to do periodic updates
Getting ready
How to do it...
How it works...
There's more...
Using C# 5.0 to perform asynchronous operations
Getting ready
How to do it...
How it works...
There's more...
What about non-CPU bound operations?
More async
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜