title: How to keep properties of separate collections in sync?
body: <p>I have a WPF application with a screen containing a tab control with two tabs.  On each tab is a datagrid, each one bound to an ObservableCollection of Part objects.  The part has a few "quantity" properties, which need to be synchronized between the grids.  For example, if the user changes the quantity of partABC on grid1, partABC either needs to be added to grid2 with the same quantity, or if grid2 already contains partABC, then its quantity must be changed to reflect grid1.</p>
  
  <p>My problem is that this must work in both directions.  If I set a PropertyChanged handler on every part in both grids, I end up with an infinite loop as they constantly update each other's quantities.  Up until now, I was handling this during the tab control selection changed event, just iterating through one of the lists and setting quantities one-by-one.  This worked well enough until I realized that the users could potentially add thousands of parts to their lists, and at that point this process takes an unacceptable amount of time to complete (around 25 seconds for 4500 part objects).</p>
  
  <p><b>edit</b><br>
  The first grid contains every part in the database, serving as sort of a "pick-list" where users simply scroll to the part they are looking for and enter quantities.  The second grid contains only parts which have been manually entered by the user, in the event that they prefer to type in the numbers of the parts they want.  Grid2 is always a subset of grid1.</p>