'Which is the difference between Celledited and TargetUpdated in a DataGrid?
I wanted to handle when a value in a cell is modify, and I would like to do it with MVVM, so I would like to know when the value of a cell is changed in a datagrid, be notify to the view model and do something according the new value. The cell is just a text cell.
I am reading about CellEdited and TargetUpdated, but I don't see really which is the difference. It seems both notify when the value is changed, but I don't know when it is better to use one and when the other.
Thanks.
Solution 1:[1]
In MVVM you would handle the change of the value in the setter of the source property whose value is displayed in the cell.
For example, given a column that is defined like this:
<DataGridTextColumn Binding="{Binding Value}" Header="Header..." />
...you would handle the change in the setter of the Value property of your data object. There should be no reason to involve any events in the view.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mm8 |
