When should I use FrameworkPropertyMetadata or UIPropertyMetadata on top of a simple PropertyMetadata?

When viewing patterns attached to properties and behavior, I saw a mess of using FrameworkPropertyMetadata , UIPropertyMetadata and PropertyMetadata . Since they all form a hierarchy of inheritance, how to choose which one to use?

+68
wpf attached-properties attachedbehaviors
Mar 21 '10 at 12:11
source share
1 answer

These classes should report some aspects of the behavior of the dependency property.

Check out the various classes for the parameters they provide.

For example,

if you just want to return the dp property and provide the default value, use PropertyMetadata ,

if you want to specify animation behavior use UIPropertyMetadata ,

but if any property affects the resources of the wpf frame level, such as the layout of the element, the parent layout, or data binding, use FrameworkPropertyMetadata .

Details you can check at msdn http://msdn.microsoft.com/en-us/library/ms751554.aspx

+67
Mar 21 '10 at 12:34
source share



All Articles