Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Property change notification broken by IBindingList
posted

Hi.

I am binding a XamDataGrid to a custom collection class derived from ObservableCollection. The child data items implement INotifyPropertyChanged.

If the collection implements IBindingList, the property update notifications are not working, so if a property on one of the data items is changed, the grid does not show the change until you force ti to re-fetch the property by editing the cell.

If I remove the IBindingList from the custom collection, the updates work correctly.

It seems that the grid is not subscribing to the PropertyChanged event on the data item if  IBindingList  is implemented by the collection.

I found someone with a similar issue in 2007 (link), but no solution was posted.

Any ideas? This would be a bit of a deal breaker...

Cheers,

Kai

 

 

 

 

 

 

Parents
  • 54937
    Suggested Answer
    Offline posted

    Actually that is correct. When the grid detects that the list implements IBindingList, it expects that you will be raising the ListChanged event of the binding list with item change notifications (i.e. the overload of the ListChangedEventArgs that takes an item index and a property descriptor that indicates the property that was changed). You can however implement the IRaiseItemChangedEvents interface and return false from the RaiseItemChangedEvents property and the grid will still hook into the INotifyPropertyChanged of each item instead of relying on the ListChanged event for item change notifications. This is how other classes like the BindingSource are implemented as well.

Reply Children
No Data