IsDirty Validation

Oct 4, 2013 at 7:15 AM
Edited Oct 4, 2013 at 7:21 AM
I'm fairly new to WPF and MVVM and I'm struggling with a simple IsDirty check.

I have a property of a model in my VM like this:
private Setting _selectedSetting;
public Setting SelectedSetting
{
    get { return _selectedSetting; }
    set
    {
             _selectedSetting = value;                
             NotifyPropertyChanged(m => m.SelectedSetting);   
     }
}
The Setting class has multiple attributes of which objects on my view binds to ie. Setting.DatabaseName, Setting.DatabasePass.

Now, whenever the user change one of those attributes on my property, say the database password, I want to set a flag (IsDirty) that could be validated later in the process or be used to disable/enable a binded object.

Am I right assuming that the change event will fire if one of the attributes changes for the SelectedSetting? Or do I need separate properties for them?

I'm sure your excellent toolkit has a simple answer that I'm totally missing.

Looking forward to your replies.
Oct 4, 2013 at 12:15 PM
ViewModelDetailBase has an IsDirty property which you may find useful.