Why do animation classes (like DoubleAnimation) require dependency properties? Dependency properties have a lot of overhead when compared to a simple property. Wouldn't passing in an object and property name and using to reflection to retrieve a setter delegate have made the animation classes more flexible and generally more usable? It would still have facilitated dependency properties, but would have the advantage of not requiring them.
+1
A:
Because you can set them with SetValue and GetValue instead of having to do all the reflection stuff to find and set the property.
Bryant
2009-11-18 00:28:22
If that were the case, the reflection stuff could just be wrapped into something easy to use like Animation.SetValue(object o, object value) or something similar. Dependency properties on the hand require a quite a bit more code than traditional properties, and forcing your object to inherit from a base class is limiting.
Mr Bell
2009-12-01 00:29:46
Reflection isn't easy and it isn't cheap. It is much cheaper performance wise to force the use of dependency objects with a dependency base class.
Bryant
2009-12-01 16:30:28