title: C# How to code EnableCollectionSynchronization for Collection of Collections
body: <p>I have searched the whole internet looking for solution w/o result.
  In my program, I have UI thread where I display in two datagrids Customers and Orders. Orders are displayed for selected customer. Definition of collections and their update happens in the background. UI purpose is only to display up to date information. I take advantage of the latest functionality introduced in C# 4.5 that is: BindingOperations.EnableCollectionSynchronization method.
  In my program I have class Customers that defines a collection of Customer class. In turn Customer class defines a collection of Order class. My problem is that I do not know <strong>how to properly code the last line of below code</strong> which relates to Order collection binding synchronisation. This code is simplified that is I omitted OnPropertyChange code lines to ensure proper properties display in data grid - I want to focus on collections.</p>
  
  <pre><code>    public class Customers()
      {
         private ObservableCollection&lt;Customer&gt; _customerslist;
         public ObservableCollection&lt;Customer&gt; customerslist
         {get { 
              if (_customerslist == null)
              {_customerslist = new ObservableCollection&lt;Customer&gt;();}
              return _customerslist;
          }private set
          {_customerslist = value;}}
     }
  
     public class Customer
     {
         public customerID;
         public customerName;
         .....
         private ObservableCollection&lt;Order&gt; _orderslist;
         public ObservableCollection&lt;Order&gt; orderslist
         {get {if (_orderslist == null)
              {_orderslist = new ObservableCollection&lt;Order&gt;();}
              return _orderslist;
          } private set
          {_orderslist = value;}}
     }
  
  public class MainWindow : Window
  {
      private static object _syncLockCustomers = new object();
      private static object _syncLockOrders = new object();
  
      public MainWindow()
      {
      InitializeComponent();
      }
  
      private void Window_Loaded(object sender, RoutedEventArgs e)
      {
      var firstCustomer = Customers.customerslist.FirstOrDefault();
  
          custDataGrid.DataContext = Customers.customerslist;
          if (firstCustomer != null)
          {
              custDataGrid.SelectedItem = firstCustomer;
              ordersDataGrid.DataContext = firstCustomer.Orders.orderslist;
          } 
  BindingOperations.EnableCollectionSynchronization(Customers.customerslist, _syncLockCustomers); 
  
  BindingOperations.EnableCollectionSynchronization(Orders &lt;-what should be here ?, _syncLockOrders);
  }
  </code></pre>
  
  <p>}</p>