Dependency property

Dependency properties use different and efficient storage. They support additional features such as
change notification
property value inheritance (the ability to propagate default values down the element tree).

They are basis for for key WPF features, including animation, data binding, and styles.
You can add dependency properties only to dependency objects—classes that derive from DependencyObject.

a simple sample control . "public sealed class BindingExpander : Control"
ex: Adding a bool property for "Dropdown expanded or not"
step1
public bool IsExpanded
{
get { return (bool)GetValue(IsExpandedProperty); }
set { SetValue(IsExpandedProperty, value); }
}
Do not do any other setvalue side validations or any other coding.

step 2
Register property
public static readonly DependencyProperty IsExpandedProperty =
DependencyProperty.Register(
"IsExpanded",
typeof(bool),
typeof(BindingExpander),
new PropertyMetadata(OnIsExpandedPropertyChanged));


step 3
Event for value change (event is named in step2 while registering)
private static void OnIsExpandedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
BindingExpander ctrl = (BindingExpander)d;
InternalContracts.AssertValue(ctrl);
bool isExpanded = (bool)e.NewValue;

if (isExpanded)
{
ctrl._currentState = ControlStates.OpenByDropDown;
}
else
{
ctrl._currentState = ControlStates.InitialState;
}
ctrl.GoToState(true);
}


DependencyProperty class. The information about your property needs to be available all the time, and possibly even shared among classes

Differences in silverlight , WPF on dependancypropertie

Coerce-value callbacks not in Silverlight.

Silverlight does not implement DependencyPropertyKey or a SetValue pattern that uses the key.
so there is no API to prevent external code from setting the dependency property through SetValue and violating your read-only intention for the property.

Only PropertyMetadata exists in Silverlight. WPF supports UIPropertyMetadata or FrameworkPropertyMetadata .
The WPF FrameworkPropertyMetadata provides a "flags" mechanism for information passing conventions, but Silverlight 5 does not support this.


The AddOwner ( dependancyproperty method) is not available in silverlight.