What is a DependencyObject?
Dependency Represents an object that participates in the dependency property system.
The class enables Windows Presentation Foundation (WPF) property system services on its many derived classes.
The property system's primary function is to compute the values of properties, and to provide system notification about values that have changed. Another key class that participates in the property system is DependencyProperty. DependencyProperty enables the registration of dependency properties into the property system, and provides identification and information about each dependency property, whereas as a base class enables objects to use the dependency properties.
services and characteristics include the following:
· Dependency property hosting support. You register a dependency property by calling the Register method, and storing the method's return value as a public static field in your class.
· Attached property hosting support. You register an attached property by calling the RegisterAttached method, and storing the method's return value as a public static read-only field in your class. (There are also additional member requirements; note that this represents a WPF specific implementation for attached properties. Your attached property can then be set on any class that derives from .
· Get, set, and clear utility methods for values of any dependency properties that exist on the .
· Metadata, coerce value support, property changed notification, and override callbacks for dependency properties or attached properties. Also, the class facilitates the per-owner property metadata for a dependency property.
· A common base class for classes derived from ContentElement, Freezable, or Visual. (UIElement, another base element class, has a class hierarchy that includes Visual.)
The following example derives from DependencyObject to create a new abstract class. The class then registers an attached property and includes support members for that attached property.