title: Multiple asynchronous UI updates in Silverlight
body: <p>How does one execute several UI updates from a Silverlight callback?  </p>
  
  <p>For example, I would like the user to click a button, have the UI make a change, do some work, then make another change...  instead, the user clicks the button and the callback seems to execute in the background and then all of the UI changes flash before my eyes.</p>
  
  <p>MainPage.xaml:</p>
  
  <pre><code>&lt;Grid x:Name="LayoutRoot" Background="White" &gt;
  &lt;TextBlock Height="23" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top"/&gt;
  &lt;Button Click="button1_Click" Content="Button" Height="23" Name="button1" Width="75"  /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>MainPage.xaml.cs:</p>
  
  <pre><code>private void button1_Click(object sender, RoutedEventArgs e)
  {
      textBlock1.Text = "1";
      // also tried Thread.Sleep(5000);
      Dispatcher.BeginInvoke(() =&gt; Thread.Sleep(5000));
      textBlock1.Text = "2";
  }
  </code></pre>