Dependency Objects
In the discussion on dependency properties,
you saw how they provide a complex yet super lightweight way of
providing many thousands of graphical objects with data that they do not have to
encapsulate directly. This reduces memory pressure and enables graphical systems
that have many more possibilities than older style UI systems.
In order to anable this flyweight pattern, a new type of object was needed. The
DependencyObject is, if you will, the base class that provides the root object
for WPF in the same way that Object provides the root for the rest of the
framework.
In order to contain dependency propeties, a DependencyObject maintains a
dictionary of key and property pairs which associate the identifier of
Class.DependencyProperty with the actual value used by the object.
As you saw from the article on dependency properties, a value may be affected by
any one of eleven different criteria which cajole and coerce the value according
to a strict precedence.
In addition to properties defined by a specific object, the DependencyObject
also provides a mechanism for hosting Attached
properties.
|