嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
WPF - Windows Presentation Foundation 4.5 Cookbook
Table of Contents
Preface 1
Chapter 1: Foundations 7
Introduction 7
Creating custom type instances in XAML 9
Creating a dependency property 15
Using an attached property 25
Creating an attached property 28
Accessing a static property from XAML 33
Creating a custom markup extension 37
Handling routed events 44
Chapter 2: Resources 51
Introduction 51
Using logical resources 52
Dynamically binding to a logical resource 57
Using user-selected colors and fonts 59
Using binary resources 63
Accessing binary resources in code 70
Accessing binary resources from another assembly 72
Managing logical resources 76
Chapter 3: Layout and Panels 81
Introduction 81
Creating a table-like user interface 83
Dynamically sizing grid rows/columns 90
Creating a scrollable user interface 92
Creating a border around panels and elements 94
Placing elements in exact positions 96
Adding/removing elements to a panel dynamically 98
Creating a tabbed user interface 100
Implementing drag-and-drop 103
This material is copyright and is licensed for the sole use by on 2nd October 2012
ii
Table of Contents
Chapter 4: Using Standard Controls 109
Introduction 109
Working with text 110
Using content controls 114
Displaying images 120
Creating tooltips 126
Creating a list of items 131
Creating a standard menu 134
Creating a context menu 137
Selecting options with checkboxes and radio buttons 139
Manipulating tab order and focus 141
Chapter 5: Application and Windows 145
Introduction 145
Creating a window 145
Creating a dialog box 149
Using the common dialog boxes 153
Creating ownership between windows 156
Creating a custom shaped window 158
Creating a single instance application 162
Handling an unhandled exception 166
Chapter 6: Data Binding 169
Introduction 169
Element to element binding 170
Binding to a single object 173
Binding to a collection 180
Using data templates 184
Using value converters 191
Creating a master-detail view 199
Sorting and filtering bound collections 202
Grouping bound collections 209
Binding to multiple properties 214
Binding hierarchical data to a TreeView 217
Presenting data in a grid 220
Validating data 228
Chapter 7: Commands and MVVM 237
Introduction 237
Using routed commands 238
Implementing a basic MVVM application 246
Building a simple MVVM framework 254
This material is copyright and is licensed for the sole use by on 2nd October 2012
iii
Table of Contents
Building a complete MVVM style application 259
Creating an undo/redo system 276
Chapter 8: Styles, Triggers, and Control Templates 285
Introduction 285
Creating and using styles 286
Applying a style automatically 291
Creating a property trigger 295
Using data triggers 299
Creating an event trigger 302
Creating a multi trigger 304
Using behaviors 306
Replacing the control template of a progress bar 310
Replacing the control template of a scroll bar 317
Customizing selection in a Selector control 321
Chapter 9: Graphics and Animation 325
Introduction 325
Creating a custom shape 326
Applying transforms on elements 333
Manipulating a bitmap programmatically 336
Creating adorners 340
Creating property-based animations 344
Creating path-based animations 350
Creating custom animations 354
Adding animation easing to animations 359
Using custom effects with pixel shaders 363
Chapter 10: Custom Elements 369
Introduction 369
Creating a user control 370
Handling standard commands in a user control 381
Creating a custom (templated) control 384
Customizing a default template of custom control 396
Creating a custom panel 398
Creating a lightweight custom element 404
Chapter 11: Threading 409
Introduction 409
Updating the UI from a non-UI thread 410
Adding cancelation support 416
Using the BackgroundWorker component 419
This material is copyright and is licensed for the sole use by on 2nd October 2012
iv
Table of Contents
Adding cancelation and progress with BackgroundWorker 423
Using a timer to do periodic updates 428
Using C# 5.0 to perform asynchronous operations 430
Index 439