I'm making a class called PanelsList
that is basically a TabControl
without the headers on the top, so the pages can only be changed programmatically. Each "tab" will be and instance of a class called PanelsListItem
that derives from Panel
. I also made a class PanelsListItemCollection
that implements ICollection
and ICollection<PanelsListItem>
. So I added the following to my PanelsList
:
private PanelsListItemCollection _Items;
public PanelsListItemCollection Items
{
get { return _Items; }
set { SetItems(value); }
}
private void SetItems(PanelsListItemCollection value)
{
if (_Items != value)
{
if (_Items != null) _Items.PanelsList= null;
_Items = value;
if (_Items != null) _Items.PanelsList= this;
}
}
I assumed that after building and adding a PanelsList
to my form I would be able to edit the PanelsListItemCollection
on design time. But when I click on the "..." button on the property Items
in the Proeprties editor, the Object Collection Editor opens but the Add and Remove buttons are disabled.
When I added a property List<Control> Stuff { get; set; }
to my PanelsList
I could add and remove controls from Stuff
on design time. I wonder if I need to implement IList
instead of ICollection
?
Edit: I just tried implementing also IList<PanelsListItem>
but it didn't fix it.