Skip to content

XAML ObjectElements which are collections

September 6, 2006

Nick Kramer has recently been blogging more and more about the XAML Language.

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:

  1. Places where a collection ObjectElement is required.
  2. Places where a collection ObjectElement is implied, and will error if you give one.
  3. 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.

From → XAML (non-UI)

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: