I have a datagrid like below in my WPF application.
When creating your own UI in DataGridTemplateColumn
(or a custom DataGrid.RowStyle for that matter), the DataGrid changes the UpdateSourceTrigger
(i.e. when the underlying data should be updated) on all your bindings to Explicit
if you didn't specify them yourself.
That "feature" is described briefly here: 5 Random Gotchas with the WPF DataGrid, and even though the author says this happens whether or not you set the UpdateSourceTrigger
yourself, setting it yourself does actually work (at least in .Net 4.0).
Use LostFocus
to mimic the default TextBox
behavior (and PropertyChanged
on CheckBox
etc):
...
...
...