Prev | Current Page 295 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"


Here??™s the five-step process WPF follows to determine a property value:
1. Determine the base value (as described previously).
2. If the property is set using an expression, evaluate that expression. Currently, WPF
supports two types of expression: resources (Chapter 11) and data binding (Chapter 15).
3. If this property is the target of animation, apply that animation.
4. Run the CoerceValueCallback to ???correct??? the value.
5. Run the PropertyChangedCallback to disallow invalid data.
Essentially, dependency properties are hardwired into a small set of WPF services. If it
weren??™t for this infrastructure, these features would add unnecessary complexity and significant
overhead.
nTip In future versions of WPF, the dependency property pipeline could be extended to include additional
services. When you design custom elements (a topic covered in Chapter 24), you??™ll probably use dependency
properties for most (if not all) of their public properties.
Understanding Routed Events
Every .NET developer is familiar with the idea of events??”messages that are sent by an object
(such as a WPF element) to notify your code when something significant occurs. WPF
enhances the .NET event model with a new concept of event routing. Event routing allows an
event to originate in one element but be raised by another one.


Pages:
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307