Bug? DataGrid.ItemsSource to INotifyCollectionChanged & IEditableCollectionView

Jan 24, 2009 at 11:40 PM
Edited Jan 24, 2009 at 11:41 PM
Hi, I have created a collection that wraps EtitySet, and implements INotifyCollectionChanged and IEditableCollectionView. Even Items implement IEditableObject. This collection is binded to DataGrid ItemsSource property. When Editing a cell I got en exception. Here is where:

-> DataGrid.OnExecutedBeginEdit()
-> DataGrid.EditRowItem()
-> ItemCollection IEditableCollectionView.EditItem()

Here is the method from PresentationFramework:
void    IEditableCollectionView.EditItem(object item)
        { 
            IEditableCollectionView ecv = _collectionView as IEditableCollectionView;
            if (ecv != null) 
            { 
                ecv.EditItem(item);
            } 
            else
            {
                throw new InvalidOperationException(SR.Get(SRID.MemberNotAllowedForView, "EditItem"));
            } 
        }

ecv is somehow null, and the exception is thrown.

When the collection does not impelemnt the interface - INotifyCollectionChanged, everyghing is ok, except, changed to collection arent visable in datagrid, which I would like. Can anyone help how to solve the problem.