Xceed Toolkit Plus for WPF v4.6 Documentation
NewItemTypesAttribute Class
Members  Example 


Xceed.Wpf.Toolkit Assembly > Xceed.Wpf.Toolkit.PropertyGrid.Attributes Namespace : NewItemTypesAttribute Class
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.
Syntax
'Declaration
 
<AttributeUsageAttribute(AttributeTargets.Property, 

   AllowMultiple=False, 

   Inherited=True)>

Public Class NewItemTypesAttribute 

   Inherits System.Attribute
'Usage
 
Dim instance As NewItemTypesAttribute
[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.
public class Person {...}

public class Man : Person {...}

public class Woman : Person {...}





public class Community

 {

   [NewItemTypes(typeof(Man), typeof(Woman))]

   public IList<Person> Members { get; set; }

 }
Inheritance Hierarchy

System.Object
   System.Attribute
      Xceed.Wpf.Toolkit.PropertyGrid.Attributes.NewItemTypesAttribute

Requirements

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

See Also

Reference

NewItemTypesAttribute Members
Xceed.Wpf.Toolkit.PropertyGrid.Attributes Namespace