title: ItemPropertyChanged not working on observableCollection.Why?
body: <p>I have searched high and low for a solution but I dont seem to get to the bottom of it.
  Like many posts on the net I dont seem to make my itemPropertyChanged work.
  It does not fire when editing an item in the collection.Why.</p>
  
  <p>a bit lenghty but this is an example I have put together.</p>
  
  <p>I have a customerViewModel that contains a Collections of OrderViewModels
  when editing the order in the datagrid the event does not fire.</p>
  
  <p>I have implemented the following but never gets fired when editing only when loading.
  As if it's not the same collection of something...</p>
  
  <pre><code>INotifyPropertyChanged inpc = OrderViewModels;
  inpc.PropertyChanged += OnItemPropertyChanged; 
  </code></pre>
  
  <p><strong>Any suggestions?It's driving me mad</strong></p>
  
  <p>Models</p>
  
  <pre><code>public class Order
  {
      public int Id { get; set; }
      public string Description { get; set; }
      public int CustomerId{ get; set; }
  }
  
  public class Customer
  {
      public Customer()
      {
          Orders=new ObservableCollection&lt;Order&gt;();
      }
  
      public int Id { get; set; }
      public string Name { get; set; }
      public string Surname{ get; set;}
      public ObservableCollection&lt;Order&gt; Orders{ get; set;}
  
  }
  </code></pre>
  
  <p>ViewModels</p>
  
  <pre><code>public class CustomerViewModel : ViewModelBase
  {
      private Customer _customerModel;
  
      public CustomerViewModel(Customer customerModel)
      {
          _customerModel = customerModel;
          _orderViewModels = new ObservableCollection&lt;OrderViewModel&gt;();
          OrderViewModels.CollectionChanged += OnOrdersCollectionChanged;
          INotifyPropertyChanged inpc = OrderViewModels;
          inpc.PropertyChanged += OnItemPropertyChanged; 
  
      }
  
      private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
      {
          //not firing!!!!!!!!!!!!!!!!!!!!!!!!!
      }
  
      void OnOrdersCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
      {
          switch (e.Action)
          {
              case NotifyCollectionChangedAction.Add:
                  _customerModel.Orders.Insert(e.NewStartingIndex, ((OrderViewModel)e.NewItems[0]).OrderModel);
                  break;
              case NotifyCollectionChangedAction.Remove:
                  _customerModel.Orders.RemoveAt(e.OldStartingIndex);
                  break;
              case NotifyCollectionChangedAction.Replace:
                  _customerModel.Orders[e.OldStartingIndex] = ((OrderViewModel)e.NewItems[0]).OrderModel;
                  break;
              case NotifyCollectionChangedAction.Move:
                  _customerModel.Orders.Move(e.OldStartingIndex, e.NewStartingIndex);
                  break;
  
              default:
                  throw new ArgumentOutOfRangeException();
          }
      }
  
      public int Id
      {
          get { return _customerModel.Id; }
          set
          {
              _customerModel.Id = value;
              OnPropertyChanged("Id");
          }
      }
  
      public string Name
      {
          get { return _customerModel.Name; }
          set
          {
              _customerModel.Name = value;
              OnPropertyChanged("Name");
          }
      }
  
      public string Surname
      {
          get { return _customerModel.Surname; }
          set
          {
              _customerModel.Surname = value;
              OnPropertyChanged("Surname");
          }
      }
      public Customer CustomerModel
      {
          get { return _customerModel; }
          set
          {
              _customerModel = value;
              OnPropertyChanged("");
          }
      }
  
      private ObservableCollection&lt;OrderViewModel&gt; _orderViewModels;
  
      public ObservableCollection&lt;OrderViewModel&gt; OrderViewModels
      {
          get { return _orderViewModels; }
          set
          {
              _orderViewModels = value;
              OnPropertyChanged("OrderViewModels");
          }
      }
  }
  
  public class OrderViewModel:ViewModelBase
  {
      private Order _orderModel;
  
      public OrderViewModel(Order orderModel)
      {
          _orderModel = orderModel;
      }
  
      public int Id
      {
          get { return _orderModel.Id; }
          set
          {
              _orderModel.Id = value;
              OnPropertyChanged("Id");
          }
      }
      public int CustomerId
      {
          get { return _orderModel.CustomerId; }
          set
          {
              _orderModel.CustomerId = value;
              OnPropertyChanged("CustomerId");
          }
      }
      public string Description 
      {
          get { return _orderModel.Description; }
          set
          {
              _orderModel.Description = value;
              OnPropertyChanged("Description");
          }
      }
  
      public Order OrderModel
      {
          get { return _orderModel; }
          set
          {
              _orderModel = value;
              OnPropertyChanged("");
          }
      }
  }
  </code></pre>
  
  <p>Repository</p>
  
  <pre><code>public class OrderRepository
  {
      public static ObservableCollection&lt;Order&gt; GetOrders(int customerId)
      {
          return new ObservableCollection&lt;Order&gt;
                 {
                     new Order {Id = 1, CustomerId=1, Description = "MotherBoard"},
                     new Order {Id = 2, CustomerId=1,Description = "Video Card"},
                     new Order {Id = 3, CustomerId=1,Description = "TV"},
                     new Order {Id = 4, CustomerId=1, Description = "Video Recorder"},
                     new Order {Id = 5, CustomerId=1,Description = "Speakers"},
                     new Order {Id = 6, CustomerId=1,Description = "Computer"}
                 };
      }
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>public partial class OrdersView
  {
      public OrdersView()
      {
          InitializeComponent();
  
          if (!DesignerProperties.GetIsInDesignMode(this))
          {
              var customerVm =
                  new CustomerViewModel(new Customer
                                            {
                                                Id = 1,
                                                Name = "Jo",
                                                Surname = "Bloggs"
                                            });
  
              var orders = OrderRepository.GetOrders(1);
              foreach (var orderModel in orders)
              {
                  customerVm.OrderViewModels.Add(new OrderViewModel(orderModel));
              }
              DataContext = customerVm;
          }
      }
  }
  </code></pre>
  
  <p>Xaml</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;DataGrid AutoGenerateColumns="False" AlternationCount="2" ItemsSource="{Binding Path=OrderViewModels}"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn Binding="{Binding Id}" Header="Id"/&gt;
              &lt;DataGridTextColumn Binding="{Binding CustomerId}" Header="Customer Id"/&gt;
              &lt;DataGridTextColumn Header="Description" Binding="{Binding Description,UpdateSourceTrigger=PropertyChanged}"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  &lt;/Grid&gt;
  </code></pre>