I know this is an old thread (but for the sake of future use...)
I do it this way:
whenever the current item (for instance of a CollectionViewSource) changes this is done:
void View_CurrentChanged(object sender, EventArgs e)
{
if (culturesView.Source != null)
{
((IEditableObject)SelectedRecord).BeginEdit();
RaisePropertyChanged("SelectedRecord");
}
}
Whenever i want to save (the current item) i do this:
private void Save()
{
((IEditableObject)SelectedRecord).EndEdit();
//do the actual saving to the dbms here ....
}
Whenever i want to cancel (current changes) i do this:
private void Cancel()
{
((IEditableObject)SelectedRecord).CancelEdit();
//allthough we have canceled the editing we have to re-enable the edit mode (because
//the user may want to edit the selected record again)
((IEditableObject)SelectedRecord).BeginEdit();
}
Hope it helps someone in the future!