WPF - UserControl default Content attribute WPF - UserControl default Content attribute wpf wpf

WPF - UserControl default Content attribute


I also found the code for supporting collections as the content property on MSDN. TOM_C is to thank for this.

[ContentProperty("SomeObjects")]public class SomeContainer{    private List<SomeObject> _someObjects;    public List<SomeObject> SomeObjects    {        get        {            if (null == _someObjects)                _someObjects = new List<SomeObject>();            return _someObjects;        }    }}

XAML:

<SomeContainer>    <SomeObject/>    <SomeObject/>    <SomeObject/></SomeContainer>