Dependency Properties
While our data-source Nickname object made its data
available via standard .NET properties, we need something special to support
data binding on the target element. While the TextContent property of
the TextBlock element is exposed with a standard property wrapper, for
it to integrate with WPF services such as data binding, styling and animation,
it also needs to be a dependency property
. A dependency property provides several features not present in .NET
properties, including the ability to inherit its value from a container
element, support externally set defaults, provide for object-independent
storage (providing a potentially huge memory savings), and change tracking.
Most of the time, you won't have to worry about dependency
properties versus .NET properties, but when you need the details, you can read
about them in the Chapter
9.
|