title: Multithread programming in WPF
body: <p>I am getting this error when I am passing browser control to my background tasks which keep track of browser control values. What change do I need in code so I can pass this browser control safely to my background scraper class.</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>The calling thread must be STA, because many UI components require this.
  </code></pre>
  
  <p>Here is how I am passing browser control to my background singleton class.</p>
  
  <pre><code>    public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
              brwser.Navigate("https://xyz.com");
          }
  
          private void Button_Click_1(object sender, RoutedEventArgs e)
          {
              Task.Factory.StartNew(() =&gt;
             {
                 if (BfScrapper.Instance.CanStart)
                     BfScrapper.Instance.StartTask(brwser);
             });
          }
      }
  </code></pre>