WPF - UserControl default Content attribute

EightyOne Unite picture EightyOne Unite · Mar 19, 2009 · Viewed 8.8k times · Source

I'm creating a UserControl and I just can't remember the name of the attribute which you use to decorate the property which you want to act as the default content property.

To give a concrete example, say i have a property called 'Title' which i can set using property syntax like this -

<local:myControl Title="the title"/>

But the consumer of the control may want to use element syntax like this -

<local:myControl> the Title </local:myControl>

I KNOW there is an attribute which I need to add to the Title property with to enable this support but I've forgotten what it is and can't find it anywhere.

Could anyone refresh my memory for me? Also, I'm looking for a similar attribute to act on CustomControls inheriting from ItemsControl.

Answer