This attribute can decorate the collection properties (i.e., IList) of your selected object in order to control the types that will be allowedto be instantiated in the CollectionControl.
'Declaration
<AttributeUsageAttribute(AttributeTargets.Property,
AllowMultiple=False,
Inherited=True)>
Public Class NewItemTypesAttribute
Inherits System.Attribute
[AttributeUsage(AttributeTargets.Property,
AllowMultiple=false,
Inherited=true)]
public class NewItemTypesAttribute : System.Attribute
Remarks
This class allows you to specify the type of object that can be added to a collection property. When a CollectionEditorDialog is used to edit the property, these types are used to populate the new type combobox.
Example
The following snippet causes the new item ComboBox to contain the "Woman" and "Man" types that can be instantiated.
publicclass Person {...}
publicclass Man : Person {...}
publicclass Woman : Person {...}
publicclass Community
{
[NewItemTypes(typeof(Man), typeof(Woman))]
public IList<Person> Members { get; set; }
}
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2