I'm writing a custom ASP.NET webcontrol and would like it to have a collection of custom items which can also be specified in the XML markup. Something like this:
class MyControl: WebControl
{
public IList<MyItemType> MyItems { get; private set; }
}
And in the markup:
<asd:MyControl runat="server" id="mc1">
<MyItems>
<MyDerivedCustomItem asd="dsa"/>
<MyOtherDerivedCustomItem asd="dsa"/>
</MyItems>
</asd:MyControl>
How do I do this? I though this was all about implementing some interface on the collection or adding some special attributes to the property, but nothing I do seems to work.