0

So I have something like this:

class ViewModel
{
    Dependency Property User User;
    public bool IsDirty;

    override OnPropertyChanged
    {
        base.OnPropertyChanged();
        this.IsDirty = true;
    }
}

The problem is that OnPropertyChanged does not trigger unless I reassign the User object. How can I get it to trigger when a property of User changes? For example when I have one User object, but User.FirstName changes. Danke.

Price Jones
  • 1,948
  • 1
  • 24
  • 40

1 Answers1

0

Each one of the properties of User must also notify on change.

E.g.:

public class User
{
    string _Name;
    public string Name 
    {
        get { return _Name; }
        set {
            _Name = value;
            PropertyChanged("Name");
        }
...
    }
}
Khan
  • 17,904
  • 5
  • 47
  • 59