title: Observable Collection Notify when property changed in MVVM
body: <p>I am trying to bind observable collection to DataGrid, i want to notify when any row is edited in datagrid. 
  My code works fine for notifing when record is added or removed but its not notifing when record is edited.
  Please let me know if this is the right way of binding using observable collection in MVVM and whether i am missing someting. Thanks in advance.</p>
  
  <pre><code>public class studentViewModel : INotifyPropertyChanged
  {
      #region constructor
  
      public studentViewModel()
      {
          _student = new studentModel();
          myCollection = new ObservableCollection&lt;studentModel&gt;();
          myCollection.Add(_student);
          myCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(myCollection_CollectionChanged);
  
      }
  
      void myCollection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
      {
          //throw new NotImplementedException();
          System.Windows.MessageBox.Show(e.Action.ToString());
      }
  
      #endregion
  
      #region properties
  
      studentModel _student;
      ObservableCollection&lt;studentModel&gt; _myCollection;
  
      public ObservableCollection&lt;studentModel&gt; myCollection
      {
          get { return _myCollection; }
          set
          {
              if (_myCollection != value)
              {
                  _myCollection = value;
                  raisePropertyChange("myCollection");
              }
          }
      }
  
      public int rollNo
      {
          get { return _student.rollNo; }
          set
          {
              if (value != _student.rollNo)
              {
                  _student.rollNo = value;
                  raisePropertyChange("rollNo");
              }
          }
      }
  
      public string firstName
      {
          get { return _student.firstName; }
          set
          {
              if (value != _student.firstName)
              {
                  _student.firstName = value;
                  raisePropertyChange("firstName");
              }
          }
      }
  
      public string lastName
      {
          get { return _student.lastName; }
          set
          {
              if (value != _student.lastName)
              {
                  _student.lastName = value;
                  raisePropertyChange("lastName");
              }
          }
      }
  
      #endregion
  
      #region INotifyPropertyChanged Members
  
      public event PropertyChangedEventHandler PropertyChanged;
  
  
      public void raisePropertyChange(string propertyName)
      {
          if (PropertyChanged != null)
          {
             PropertyChanged(this,new PropertyChangedEventArgs(propertyName));
          }
      }
  
      #endregion
  }
  
  public class studentModel
  {
      public int rollNo { get; set; }
      public string firstName { get; set; }
      public string lastName { get; set; }
  }
  </code></pre>
  
  <p>And xaml is </p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;local:studentViewModel x:Key="StudentsDetails" /&gt;
  &lt;/Window.Resources&gt;
  &lt;Grid DataContext="{StaticResource StudentsDetails}"&gt;
      &lt;DataGrid ItemsSource="{Binding Path=myCollection, Source={StaticResource StudentsDetails}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                Name="studentsGrid" CanUserAddRows="True" AutoGenerateColumns="True"&gt;
  
      &lt;/DataGrid&gt;
  &lt;/Grid&gt;
  </code></pre>