开发者

When should I use FrameworkPropertyMetadata or UIPropertyMetadata over plain PropertyMetadata?

开发者 https://www.devze.com 2022-12-24 16:39 出处:网络
When looking at sample attached properties and behaviors, I\'ve seen a mishmash开发者_如何学Go of uses of FrameworkPropertyMetadata, UIPropertyMetadata and PropertyMetadata. Since they all form an inh

When looking at sample attached properties and behaviors, I've seen a mishmash开发者_如何学Go of uses of FrameworkPropertyMetadata, UIPropertyMetadata and PropertyMetadata. Since they all form an inheritance hierarchy, how do I choose which one to use?


These classes are to report some behavior aspects of a dependency property.

Check the different classes for the options they provide.

For example,

if you just want to back a property by dp and provide a default value, use PropertyMetadata,

if you want to specify animation behavior, use UIPropertyMetadata,

but if some property affects wpf framework level stuffs eg element layout, parent layout or databinding, use FrameworkPropertyMetadata.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消