title: How do I refresh visual control properties (TextBlock.text) set inside a loop?
body: <p>With each loop iteration, I want to visually update the text of a textblock. My problem is that the WPF window or control does not visually refresh until the loop is complete.</p>
  
  <pre><code>for (int i = 0; i &lt; 50; i++)
  {
      System.Threading.Thread.Sleep(100);
      myTextBlock.Text = i.ToString();                
  }
  </code></pre>
  
  <p>In VB6, I would call <code>DoEvents()</code> or <code>control.Refresh</code>. At the moment I'd just like a quick and dirty solution similar to <code>DoEvents()</code>, but I'd also like to know about alternatives or the "right" way to do this. Is there a simple binding statement I could add? What is the syntax?
  Thanks in advance.</p>