title: WPF Toolkit Community Edition Property Grid: New Item Types in Collection Editor
body: <p>I use the property grid of WPF Toolkit CE.
  On adding an object to a collection, the opened dialog shows a combobox to select the new type to be added. In the documentation I read for <code>NewItemTypesAttribute</code>:
  <em>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.</em></p>
  
  <p>But I cannot get it working.
  Here are the last variant I tried:</p>
  
  <pre><code>namespace TestPropertyGrid
  {
    /// &lt;summary&gt;
    /// Interaktionslogik für MainWindow.xaml
    /// &lt;/summary&gt;
    public partial class MainWindow : Window
    {
      public MainWindow()
      {
        InitializeComponent();
  
        MyObject myObj = new MyObject();
        this.PGrid.SelectedObject = new MyObject();
      }
    }
  
    public class MyObject
    {
      [NewItemTypes(typeof(MyBaseObj), typeof(MyObj1))]
      [Editor(typeof(CollectionEditor), typeof(CollectionEditor))]
      public ArrayList ListOfObjects { get; set; } = new ArrayList();
    }
  
    public class MyBaseObj
    {
    }
  
    public class MyObj1
    {
    }
  }
  </code></pre>
  
  <p>In this case the "select type" list is empty.</p>
  
  <p>I try to use a <code>List&lt;object&gt;</code> instead of <code>ArrayList</code> but the list contains only the type Object.</p>
  
  <p>Initialy I wanted a <code>List&lt;MyBaseObj&gt;</code> (would be an abstract class) and add objects of type <code>MyObj1</code>resp <code>MyObj2</code> which would both inherit from <code>MyBaseObj</code>. Same as in the documentation sample:</p>
  
  <pre><code>  public partial class MainWindow : Window
    {
      public MainWindow()
      {
        InitializeComponent();
        Community myObj = new Community();
        myObj.Members = new List&lt;Person&gt;();
        this.PGrid.SelectedObject = myObj;
      }
    }
  
    public class Community
    {
      [NewItemTypes(typeof(Man), typeof(Woman))]
      [Editor(typeof(CollectionEditor), typeof(CollectionEditor))]
      public IList&lt;Person&gt; Members { get; set; }
    }
  
    public class Person { }
    public class Man : Person  { }
    public class Woman : Person  { }
  </code></pre>
  
  <p>I hope I could explain my problem clearly and someone could help. Thank you.</p>