When implementing a content property of a collection type, the following information can be helpful:
Make sure
only the getter of your property is made public.
- By doing so, you don't have to provide an entire collection as content, instead you can directly add the children to the content.
Example:
C#:[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>