title: Update UI from an Async method
body: <p>I have this method what called from an Async method</p>
  
  <pre><code>private void SocketConnected(Object sender, EventArgs e) {
      //Some code
  
  
      connectedLabel.Content = "Connected";
  }
  </code></pre>
  
  <p>And the <code>connectedLabel.Content = "Connected";</code> throws an error. How can I update this from this method? I've seen a few post saying use Invoke, however, that gives me an error that label doesn't have a Invoke method.</p>
  
  <p>EDIT:</p>
  
  <p>From looking at Dispatcher as mentioned in the comments I've got this which works.</p>
  
  <pre><code>    private string message;
      public void UpdateConnected()
      {
          connectedLabel.Content = message;
      }
  
      private void SocketConnected(Object sender, EventArgs e) {
          //Some stuff
  
          message = "Connected";
          this.Dispatcher.BeginInvoke(new Action(this.UpdateConnected), DispatcherPriority.Background);
      }
  </code></pre>
  
  <p>Is that the correct usage of the Dispatcher?</p>