title: The calling thread must be STA, because many UI components require this WPF
body: <p>I am using the MessageBox provided by <a href="http://wpftoolkit.codeplex.com/wikipage?title=MessageBox" rel="nofollow">WPF Toolkit</a>. And I get the error </p>
  
  <p><strong>The calling thread must be STA, because many UI components require this</strong></p>
  
  <pre><code>new Thread(new ThreadStart(delegate
  {
      MessageBox.Show("Opeartion could not be completed. Please try again.","Error",MessageBoxButton.OK,MessageBoxImage.Error);
  })).Start();
  </code></pre>
  
  <p>How can I set the ApartmentState in this case</p>
  
  <p>Edit:
  I am trying to display a modeless MessageBox using MessageBox control of WPF Toolkit.
  So far the code I have is as follows:</p>
  
  <pre><code>void SomeFunction()
  {
  // calls to some UI, and processing and then
  
  var th = new Thread(new ThreadStart(delegate
                                          {
                                             MessageBox.Show("Opeartion could not be completed. Please try again.",
                                                  "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                                          }));
  
                                          th.SetApartmentState(ApartmentState.STA);
                                          th.Start();
                                      }
  }
  </code></pre>