title: Communication between Multiple Threads in a WPF Application
body: <p>I added an event handler to my code and it broke all access to the CollectionViewSources in the SystemHTA class saying "The calling thread cannot access this object because a different thread owns it".  My class was working when "this.systemHTA = new SystemHTA();" was placed outside of the DeviceManager_StateChanged() function.</p>
  
  <pre><code>    public partial class MainWindow : Window
      {
          private DeviceManager DeviceManager = DeviceManager.Instance;
          public SystemHTA systemHTA;
  
          public MainWindow()
          {
              InitializeComponent();
          }
  
          private void Window_Loaded(object sender, RoutedEventArgs e)
          {
              DeviceManager.StateChanged += new EventHandler&lt;DeviceManagerStateChangedEventArgs&gt;(DeviceManager_StateChanged);
              DeviceManager.Initialize();
          }
  
          void DeviceManager_StateChanged(object sender, DeviceManagerStateChangedEventArgs e)
          {
              if (e.State == DeviceManagerState.Operational)
              {
                  this.systemHTA = new SystemHTA();
              }
          }
  
          private void button1_Click(object sender, RoutedEventArgs e)
          {
              this.systemHTA.GetViewSourceTest();
          }
      }
  
  
      public class SystemHTA
      {
          private CollectionViewSource _deviceTestSource;
  
          public SystemHTA()
          {
              _deviceTestSource = new CollectionViewSource();
              _deviceTestSource.Source = CreateLoadData&lt;HWController&gt;.ControllerCollection;
          }
  
          public void GetViewSourceTest()
          {
              ListCollectionView view = (ListCollectionView)_deviceTestSource.View; //This creates an error saying a thread already owns _deviceTestSource
          }
      }
  </code></pre>