private void documentDataModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { DocumentDataModel dataModel = sender as DocumentDataModel; if (dataModel.State == DataModel.ModelState.Invalid && this.prop_DocumentChanged) { return; } this.Document.Text = dataModel.SaveDocument(); this.IsDirty = false; this.prop_DocumentChanged = false; }