Can you think of a scenario where IEditableObject would be still usefull in an MVVM-based WPF application? If so, do you have an example that demonstrates this.
Within a type being displayed in a DataGrid. This was needed since when I am making use of tabs and a DataGrid is being stored within that tab switching the tabs needed to force a commit so to speak within the DataGrid if a cell was active; rolling back the changes since they were not committed. T
There is a behavior being applied to the DataGrid to achieve this functionality but the IEditableObject portion is below.
private IDatabaseConnection _copy;
void IEditableObject.BeginEdit()
{
if (this._copy == null)
this._copy = _container.Resolve();
_copy.Database = this.Database;
_copy.DisplayName = this.DisplayName;
_copy.HostName = this.HostName;
_copy.Username = this.Username;
_copy.Password = this.Password;
}
void IEditableObject.CancelEdit()
{
this.Database = _copy.Database;
this.DisplayName = _copy.DisplayName;
this.HostName = _copy.HostName;
this.Username = _copy.Username;
this.Password = _copy.Password;
}
void IEditableObject.EndEdit()
{
_copy.Database = String.Empty;
_copy.DisplayName = String.Empty;
_copy.HostName = String.Empty;
_copy.Username = String.Empty;
_copy.Password = String.Empty;
}