title: Updating UI from a background Thread and thread within a Thread
body: <p>I have following Application Structure:  </p>
  
  <pre><code>public partial class MainWindow : Window
  {
      // Methos to update the TextBlock
      public void updateTextBlock(string txt)
      {
          this.myTextBlock.Text += txt;
      }        
  
      private void startThreadBtn_Click(object sender, RoutedEventArgs e)
      {
          // Start Thread1 here 
          Thread1 thread1 = new Thread1();
          new Thread(new ThreadStart(thread1.doSomthing)).Start(); 
      }
  }
  
  class Thread1
  {
      public void doSomthing()
      {
          // ------------------------------
          // Update myTextBlock from here 
          // ------------------------------
  
          // Thread2 starts here 
          Thread2 thread2 = new Thread2();
          new Thread(new ThreadStart(thread2.doSomthing)).Start(); 
      }
  } 
  
  class Thread2
  {
      public void doSomthing()
      {
          // ------------------------------
          // Update myTextBlock from here 
          // ------------------------------
      }
  }
  </code></pre>
  
  <p>From both of these threads <code>Thread1</code> and <code>Thread2</code> classes I want to update the <code>TextBlock</code> which is in the <code>MainWindow</code>.  </p>
  
  <p>I have seen following solutions, and don't find this condition covered in this questions, also i am beginner and find it way difficult to understand.   </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/9602567/how-to-update-ui-from-another-thread-running-in-another-class">How to update UI from another thread running in another class</a></li>
  <li><a href="https://stackoverflow.com/questions/661561/how-to-update-the-gui-from-another-thread-in-c">How to update the GUI from another thread in C#?</a></li>
  <li><a href="https://stackoverflow.com/questions/7959005/update-ui-from-background-thread">Update UI from background Thread</a></li>
  </ul>
  
  <p>I can use solutions provided in the above questions for <code>Thread1</code> but what about updating UI from <code>Thread2</code>.<br>
  I am using .NET framework 4.5.<br>
  What is the best way of doing it.   </p>