title: Raising event when Property in ObservableCollection changes
body: <p>I want to raise an Event when a Property in a DataGrid is changed to check if it is valid, save it back to my source file, etc.</p>
  
  <p><strong>Background Information:</strong>
  I have a DataGrid which is bound to an Observable Collection.
  At this point I have successfully bound my Observable Collection to the view, however I haven't managed to raise an Event upon Property changes.
  Two Way binding also works as i could observe changes to the Collection via debugging.
  I'm inheriting INotifyPropertyChanged through BindableBase(Prism).</p>
  
  <pre><code>public ObservableCollection&lt;CfgData&gt; Cfg
  {
      get { return _cfg; }
      set { SetProperty(ref _cfg, value); }
  }
  private ObservableCollection&lt;CfgData&gt; _cfg;
  </code></pre>
  
  <p>CfgData contains 4 Properties:</p>
  
  <pre><code>public class CfgData
  {
      public string Handle { get; set; }
      public string Address { get; set; }
      public string Value { get; set; }
      public string Description { get; set; }
  
      public CfgData(string handle, string address, string value)
      {
          this.Handle = handle;
          this.Address = address;
          this.Value = value;
      }
  
      public CfgData(string handle, string address, string value, string description)
      {
          this.Handle = handle;
          this.Address = address;
          this.Value = value;
          this.Description = description;
      }
  }
  </code></pre>
  
  <p>I am populating my Observable Collection with Values read from a csv. file</p>
  
  <pre><code>public ObservableCollection&lt;CfgData&gt; LoadCfg(string cfgPath)
  {
  var cfg = new ObservableCollection&lt;CfgData&gt;();
  try
  {
      using (var reader = new StreamReader(cfgPath))
      {
          while (!reader.EndOfStream)
          {
              var line = reader.ReadLine();
              var values = line.Split(';');
  
              if (values.Length == 3)
              {
                  cfg.Add(new CfgData(values[0], values[1], values[2]));
              }
              else if (values.Length == 4)
              {
                  cfg.Add(new CfgData(values[0], values[1], values[2], values[3]));
              }
          }
      }
  }
  catch (Exception x)
  {
      log.Debug(x);
  }
  return cfg;
  }
  </code></pre>
  
  <p><strong>My XAML</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;DataGrid Name="cfgDataGrid" Margin="10,10,109,168.676" ItemsSource="{Binding Cfg, Mode=TwoWay}" AutoGenerateColumns="False"&gt;
    &lt;DataGrid.Columns&gt;
      &lt;DataGridTextColumn Header="Handle" Binding="{Binding Path=Handle}" Width="auto" IsReadOnly="True" /&gt;
      &lt;DataGridTextColumn Header="Address" Binding="{Binding Path=Address}" Width="auto" IsReadOnly="True" /&gt;
      &lt;DataGridTextColumn Header="Value" Binding="{Binding Path=Value}" Width="auto" IsReadOnly="False" /&gt;
      &lt;DataGridTextColumn Header="Description" Binding="{Binding Path=Description}" Width="auto" IsReadOnly="True" /&gt;
    &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>The Problem</strong>
  2 way binding updates the collection in my viewmodel. However i would like to verify the input before saving it. I would also like to be able to add some functionality like calling a method when an edit is verified. Therefore I have attempted to use several event handling ways like</p>
  
  <pre><code>this.Cfg.CollectionChanged += new NotifyCollectionChangedEventHandler(Cfg_OnCollectionChanged);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>this.Cfg.CollectionChanged += Cfg_OnCollectionChanged;
  </code></pre>
  
  <p>however those never called the functions when i changed the datagrid.</p>
  
  <p><strong>The Questions</strong>
  How do i create an event handler that gets called upon a Property change? Do i have to save back the whole set of Data or can i save back just the changed datarow/property? </p>