In my viewmodel, there is a property CurrentObject
of the type SomeDomainType
which is serializeable.
There is a form to edit its properties, and one of the buttons is "Commit Changes", databound to the ICommand CommitChangesCommand
.
Now I expect this button to be active (via CanCommitChangesCommand()
, properly wired with Josh Smith's RelayCommand
) only when the object has been modified, that is, the object is "dirty".
Saying it again, what I want to ask is:
"How can I mark an object as dirty so that I could have a
private bool ThatPropertyIsDirty()
method to check that inside someCanExecute()
?"
From the sound of it:
IsDirty
property onto your SomeDomainType
IsDirty
raise the NotifyPropertyChanged
event for IsDirty
SomeDomainType
that you change to make the object considered Dirty
, in their setters, set IsDirty
to trueThis is presuming your SomeDomainType
implements the INotifyPropertyChanged
interface. If not, create a wrapper class around the SomeDomainType
that does, and make the above changes to that wrapper.