Hi i am having some troube with DataTables. So What i need is to detect whenever i change any cell in the DataGrid of the DataTable that is binded.
How to do it? With INotifyPropertyChanged
or with INotifyCollectionChanged
?
Note: I am trying with INotifyPropertyChanged
but it only detects when i set some value in the DataTable, and never when i change any value of any cell in the DataGrid, i already have tried OneWay
and TwoWay
but nothing happens.
Thanks in advance!
The datagrid would be bound to a list of objects. If you want the grid to update when individual object properties change, than each contained object must implement the INotifyPropertyChanged
interface.
The INotifyCollectionChanged
is an interface that the collection should implement, and are for notifications of addition and removal events.
See the section "How to implement collections" on this page.
DataRow
. On this class implement INotifyPropertyChanged
.DataTable
, use an ObservableCollection<T>
or your new class.ObservableCollection
already implements INotifyCollectionChanged
, so this saves you the effort of implementing it yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With