title: The calling Thread cannot access this object because a different thread owns it. Exception
body: <pre><code>private void Thread1_Exe()
  {
      try
      {
          int sleepValT1 = Convert.ToInt32(listBoxT2.SelectedValue);
          int StartLoop = 0;
          int EndLoop = 10000;
  
          for (int i = StartLoop; i &lt;= EndLoop; i++)
          {
              Dispatcher.BeginInvoke(
              new Action(() =&gt; listboxE1.Items.Add("T1: Execution Count&gt; " + i.ToString())));
              Thread.Sleep(sleepValT1);
          }
  
      }
      catch (Exception Ex)
      {
          MessageBox.Show(Ex.Message);
      }
  }
  </code></pre>
  
  <p>I was trying to call the above function on different thread</p>
  
  <pre><code>private void thread1_Click(object sender, RoutedEventArgs e)
  {
      threadBtn1.IsEnabled = false;
      Thread t1 = new Thread(new ThreadStart(Thread1_Exe));
  
      t1.Start();
  }
  </code></pre>
  
  <p>But the Exception occurs when i select the value from the listbox and try to save it in the variable and then try to pass that value in </p>
  
  <pre><code>Thread.Sleep()
  </code></pre>
  
  <p>I always get this Exception that the different thread owns this object. Tried Many things. Please help me out where i am doing mistake. </p>
  
  <p>Thanks</p>