We had some problems with wpf datagrid and IEditableCollectionView (although this question relates to using IEditableCollectionView and ItemsControl). When you have a collection in which there are no elements, IEditableCollectionView cannot determine which elements should be inserted so that they install, CanAddNew=falsewe found a solution here (deeply immersed in the comments), which looks like this:
If you exit ObservableCollection, like this
public class PersonsList : ObservableCollection<Person> { }
you will know that if the original collection is empty, NewItemPlaceHolder will not appear on the screen. This is because PeopleList cannot resolve type T at design time. The workaround that works for me is to pass type T as a parameter to a class like this
PersonsList<T> : ObservableCollection<T> where T : Person { }
This approach will put NewItemPlaceHolder even if the collection is empty.
I am wondering if there is an interface that I can implement in my collections that report an IEditableCollectionView that needs to be created so that I receive an AddNew request.
source
share