XAML ObjectElements which are collections
He just did a nice post about how ObjectElements which represent collections (IList or IDictionary) are sometimes Implicit in "Implicit and explicit tags in xaml".
He mentions 3 cases:
- Places where a collection ObjectElement is required.
- Places where a collection ObjectElement is implied, and will error if you give one.
- Places where a collection ObjectElement is optional.
A few CTPs ago, we cleaned up this area to where we are today. The only reason to ever use a collection ObjectElement in XAML is for case #1 (I don’t know any WPF examples offhand…i’ll update when I learn of one) or for case #3 (if you need to set a property on the collection object – for example, ResourceDictionary.MergedDictionaries).
We used to have a behavior for #2 where you could put a collection ObjectElement in markup, but it would be discarded since the property getter (Children in Nick’s example) already returned a collection.