title: WPF invoke method when model property changes
body: <p>It is a problem that I face for a long time.
  <br>
  Let say that we have a POCO class called Person (INotifyPropertyChanged is provided using Foldy and its [AddINotifyPropertyChangedInterface] attribute)</p>
  <pre><code>[AddINotifyPropertyChangedInterface]
  public class Person
  { 
          public int Id{ get; set; }
  
          [StringLength(20)]
          [Required(ErrorMessage = &quot;Field required&quot;)]
          public string FirstName { get; set; }
  
  
          [Required(ErrorMessage = &quot;Field required&quot;)]
          public string LastName{ get; set; }
  }
  
  </code></pre>
  <p>And in ViewModel I reference this class as a Property</p>
  <pre><code>public class SomeViewModel
  {
     public Person Person
     {
        get =&gt; person;
        set
        {
            person= value;
            SomeMethod();
        }
     }
  // Rest of the code
  }
  </code></pre>
  <p>And question is how can I invoke &quot;SomeMethod&quot; when first name is changed in textbox.
  <br>Textbox is bound to property as follows:</p>
  <pre><code>&lt;TextBox Text=&quot;{Binding Person.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged)/&gt;
  </code></pre>
  <p>I tried to work around it binding to:</p>
  <pre><code> public string FirstName
   {
     get =&gt; firstName;
     set
        {
          firstName= value;
          Person.FirstName=value;
          SomeMethod();
        }
   }
  </code></pre>
  <p>But the problem is with validation in the user form because I use data annotation attributes in POCO class for validation.</p>
  <p>Thank you in advance for your help and your time!</p>