1. How to explain DependencyProperty using real world analogy?
  2. Why is it needed?
  • For number 1, are you trying to explain what it's used for, or how it's implemented? – nlawalker Dec 15 '10 at 17:20

I like Dave's answer, but I will say that this is how I usually think about DependencyProperties, at least with Silverlight (I think WPF is similar):

  • If you want to create something that can be target of a binding, you want to create a class that implements INotifyPropertyChanged.
  • If you want to create something that you can define in XAML and be bound to something, you want to create a derivative of DependencyObject with DependencyProperties.

Gaining that understanding was a turning point in my ability to design things in Silverlight appropriately.

  • I think your second point misses the fact that DependencyObject with DependencyProperties can also be a target. The real difference is that INotifyPropertyChanged should be in the ViewModel layer and DependencyObjects are for the View layer. – Scott Whitlock Dec 27 '10 at 3:50
  • @Scott Whitlock. You are probably right. I'm new to the concepts and those bullet points are what I've been using to keep things straight in my head. There are probably some subtleties I'm missing. – RationalGeek Dec 28 '10 at 13:49

From an answer to my post on StackOverflow by Kent Boogart:

In order for a property to be the target of a binding, that property must be a dependency property. WPF (and Silverlight) use dependency properties as a means for tracking changes, supporting value precedence (for animations and the like), and a bunch of other useful things. Note that I said "target". The source of a binding can be any old object that supports change notification.

This small tidbit of knowledge has really helped me out. So use it if you want to databind to properties in your custom UserControls.


For a real-world analogy, I guess I would go with a Phone Book entry.

There are lots of people/phone numbers in the world, but to be found by everyone you post your number in the phone book.

Likewise, there are many regular properties that exist, and items that are aware of them know they exist and can use them, but a DependencyProperty is something that the entire application is aware of and can lookup when needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.