Charles Petzold



Dependency Properties and Data Bindings

Mary 12, 2007
New York, N.Y.

As Don Box demonstrates, WPF data binding sources do not have to be dependency properties. Of course I know that, having blogged about that very subject over a year ago. (Reading that entry over today, I find it's not a bad overview.)

However, targets of data bindings are a whole 'nother matter. Targets of data bindings are required to be dependency properties, as a quick glance at the FrameworkElement.SetBinding method will tell you.

Also, targets of animations must be dependency properties.

Also, you probably don't want to derive from Freezable unless all your public properties are dependency properties. Otherwise you're just making lots of work for yourself.

Dependency properties are so integral to the workings of WPF and XAML that nary a day goes by when I don't define one, even when the property will potentially serve only as a binding source rather than a target. Although it took me awhile to get accustomed to it, I like the structure that dependency properties imposes on my WPF classes.

Anyone who studies the documentation of existing WPF classes will recognize how much importance the WPF developers ascribed to dependency properties. It would be foolish for any WPF application programmer to ignore that.