#158 – When to Create a Custom Dependency Property
December 17, 2010 1 Comment
When you’re implementing a new class and creating properties of that class, you need to decide for each property whether to make it a full-fledged WPF dependency property.
If a property is a standard CLR property, rather than a dependency property, you can still set property values from XAML.
But you might want to create a custom dependency property if you want your class to do any of the following:
- Set the property from a style
- Use data binding on the property
- Set property value using DynamicResource
- Get property value through inheritance
- Get property value through animation
- Use PropertyChanged, CoerceValue or ValidateValue callbacks
- You want support for the property in the Visual Studio or Blend designers