title: async with label text
body: <p>I have a button, when I click it, I want it to update the UI with the value</p>
  
  <p>this is my button</p>
  
  <pre><code>       private async void Button_Click(object sender, RoutedEventArgs e)
         {
          await DoItAsync();
         }
  </code></pre>
  
  <p>and this is DoIt!</p>
  
  <pre><code>    public async Task DoSomethingAsync()
      {
         await Task.Run(()=&gt;{
              for(int i = 0; i &lt; 2000; i++)
              {
                 //labelName.Content = i.ToString();
                 Console.WriteLine(i);
              }
  
          });
      }
  </code></pre>
  
  <p>so if I run the above code, click my button, DoItAysnc is called and all the numbers are displayed in the console.</p>
  
  <p>If I un-comment</p>
  
  <pre><code>labelName.Content = i.ToString(); 
  </code></pre>
  
  <p>I get an exception, the following in fact :  The calling thread cannot access this object because a different thread owns it.</p>
  
  <p>I know Async and await don't solve threading for you, but I did think this would work. I would like to know how to get this to work so that the UI is updated for each i value without the UI becoming unresponsive.</p>
  
  <p>Any good resources on this would be helpful also.</p>
  
  <p>As always, kinds regards</p>