The ultimate goal of a dependency property is to manage state. The dependency property is not unique to Windows Workflow; it is also present in WF's XAML sibling—Windows Presentation Foundation. A dependency property enables a handful of critical features in WF:
Activity property binding
Attached properties
Meta-properties
Every class that uses a dependency property will ultimately derive from the abstract DependencyObject
class. Shown in the screenshot overleaf, the DependencyObject
provides methods to manipulate dependency properties, like GetValue
and SetValue
. Also shown in the following figure is the DependencyProperty
class.
This class represents the metadata that describes a dependency property, like the Name and OwnerType.
We've already seen some of these DependencyObject
methods used when we created a UserName
property for our custom composite activity. Let's look again at a portion of that code that the designer generated:
public String UserName
{
get
{
return ...