INotifyPropertyChanged
is not the only interface that WPF binding can use for change notification, it's just the one we're most used to. As Bea Stollnitz writes, the ADO DataView
implements IBindingList
, which implements change notification by raising ListChanged
when the list or an item in it changes.
This suggests a way to get what you want, though I haven't tried it to see how it works. You can derive a class from DataView
that listens to the DataTable.RowChanged
event and raises ListChanged
if the row is in the view and its RowState
changed.
You won't be able to instantiate this new DataView
in XAML without using any code-behind or implementing a view model, since if you just bind to the DataTable
it will create a normal DataView
. But you can fix that, too: subclass DataTable
and override GetDefaultView
to make it return an instance of your new DataView
, and then subclass DataSet
and override Tables
to make it return an instance of your new DataTable
. (None of these classes appear to be sealed, thank goodness.)
Edit
Of course it's not as simple as that. The list that DataView
exposes is a collection of DataRowView
objects. DataRowView
implements INotifyPropertyChanged
. I think that WPF uses the IBindingList
interface on DataView
for collection-changed notification and listens to PropertyChanged
on DataRowView
, though honestly I'd need to dig quite a bit more to be sure.
DataRowView
only raises PropertyChanged
when the value of a column in its row changes. I can't see any way to inject change-notification for other properties into that without subclassing DataRowView
, and while that's possible in principle, I can't see a straightforward way of subclassing DataView
to create these new DataRowView
objects.