title: How do I update an ObservableCollection via a worker thread?
body: <p>I've got an <code>ObservableCollection&lt;A&gt; a_collection;</code> The collection contains 'n' items. Each item A looks like this:</p>
  
  <pre><code>public class A : INotifyPropertyChanged
  {
  
      public ObservableCollection&lt;B&gt; b_subcollection;
      Thread m_worker;
  }
  </code></pre>
  
  <p>Basically, it's all wired up to a WPF listview + a details view control which shows the <code>b_subcollection</code> of the selected item in a separate listview (2-way bindings, updates on propertychanged etc.). </p>
  
  <p>The problem showed up for me when I started to implement threading. The entire idea was to have the whole <code>a_collection</code> use it's worker thread to "do work" and then update their respective <code>b_subcollections</code> and have the gui show the results in real time.</p>
  
  <p>When I tried it , I got an exception saying that only the Dispatcher thread can modify an ObservableCollection, and work came to a halt.</p>
  
  <p>Can anyone explain the problem, and how to get around it?</p>