When looking at sample attached properties and behaviors, I've seen a mishmash of uses of FrameworkPropertyMetadata, UIPropertyMetadata and PropertyMetadata. Since they all form an inheritance hierarchy, how do I choose which one to use?
views:
705answers:
1
+2
Q:
When should I use FrameworkPropertyMetadata or UIPropertyMetadata over plain PropertyMetadata?
+3
A:
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
gp
2010-03-21 12:34:56
The real question is, why does the propdp snippet use UIPropertyMetadata, especially since there are no PropertyMetadata subclasses in Silverlight? It drives me nuts.
Grank
2010-06-29 23:32:48
That's because same snippets are shared between WPF and Silverlight.You can try different snippets for silverlight from this link:http://blog.nerdplusart.com/archives/silverlight-code-snippets
gp
2010-07-08 07:54:46
+1 Editing the snippets is so simple as well.
Avatar
2010-09-14 07:16:24