title: WPF: IEditableCollectionView and CanAddNew and empty collections
body: <p>We were having some issues with the wpf datagrid and IEditableCollectionView (although this question applies to using IEditableCollectionView and ItemsControl) When you have a collection with no items in it, the IEditableCollectionView cannot determine what items should be inserted so it sets <code>CanAddNew=false</code> we found a solution <a href="http://blogs.msdn.com/vinsibal/archive/2008/05/27/using-ieditablecollectionview-with-dynamically-generated-gridviewcolumns.aspx" rel="nofollow noreferrer">here</a> (buried deep in the comments) that goes like so :</p>
  
  <p>If you derive from ObservableCollection like this</p>
  
  <pre><code>public class PersonsList : ObservableCollection&lt;Person&gt; { }
  </code></pre>
  
  <p>you will find out that if the initial collection is empty, there won't be a NewItemPlaceHolder showing up on the view. That's because PersonsList cannot resolve type T at design time. A workaround that works for me is to pass type T as a parameter into the class like this</p>
  
  <pre><code>PersonsList&lt;T&gt; : ObservableCollection&lt;T&gt; where T : Person { }
  </code></pre>
  
  <p>This approach will place the NewItemPlaceHolder even if the collection is empty.</p>
  
  <p>I'm wondering if there is an interface i can implement on my collections that inform the IEditableCollectionView which type to create should i get an AddNew request.</p>