So the simple (I hope) solution is to create a IsModelDirty property at the model level. Avoid IsDirty because it is not overrideable and setting it false is enough to set the model dirty again (ie IsDirty becomes true). Override OnPropertyChanged in the Model and set your IsModelDirty true in it. In my case there is no need to ensure that the property being changed is NOT IsDirty because of my flow of control. The framework has already set it True and neither the framework or I ever set it False again. In my Model constructor I set LeanAndMeanModel to true. I override OnBeginEdit, OnEndEdit and OnCancelEdit in the Model. The code for each of them is below.
/// <inheritdoc />
protected override void OnBeginEdit (System.ComponentModel.BeginEditEventArgs e)
{
base.OnBeginEdit(e);
IsModelDirty = false;
LeanAndMeanModel = false;
}/* method TLModelBase OnBeginEdit */
/// <inheritdoc />
protected override void OnCancelEdit (System.ComponentModel.EditEventArgs e)
{
LeanAndMeanModel = true;
base.OnCancelEdit(e);
IsModelDirty = false;
LeanAndMeanModel = false;
}/* method TLModelBase OnCancelEdit */
/// <inheritdoc />
protected override void OnEndEdit (System.ComponentModel.EditEventArgs e)
{
LeanAndMeanModel = true;
base.OnEndEdit(e);
IsModelDirty = false;
LeanAndMeanModel = false;
}/* method TLModelBase OnEndEdit */
Lastly, override HasDirtyModel to access IsDirtyFlag for each Model registered for the ViewModel by using GetAllModels().