Prev | Current Page 272 | Next

Matthew MacDonald

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

Dependency properties are also the basis for a number of key WPF
features, including animation, data binding, and styles. Fortunately, even though the plumbing
has changed, you can read and set dependency properties in code in exactly the same way
as traditional .NET properties.
The second shift replaces ordinary .NET events with a higher-level routed event feature.
Routed events are events with more traveling power??”they can tunnel down or bubble up the
element tree and be processed by event handlers along the way. Routed events allow an event
to be handled on one element (such as a label) even though it originates on another (such as
an image inside that label). As with dependency properties, routed events can be consumed in
the traditional way??”by connecting an event handler with the right signature??”but you need
to understand how they work to unlock all their features.
In this chapter, you??™ll start by taking a look at dependency properties. You??™ll see how
they??™re defined and what features they support. Then you??™ll explore the WPF event system and
learn how to fire and handle routed events. Finally, you??™ll consider the essential WPF events
for dealing with mouse and keyboard actions.
Understanding Dependency Properties
Dependency properties are a completely new implementation of properties??”one that has a
significant amount of added value.


Pages:
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284