title: Is there any command to update UI immediately?
body: <p>I want to update a progress bar from running 1 to 100 with this code.</p>
  
  <pre><code>for (int i = 0; i &lt;= 100; i++) {
      System.Threading.Thread.Sleep(100);
      progressBar1.Value = i;
  }
  </code></pre>
  
  <p>But the result is, the UI freeze until looping finish.</p>
  
  <p>I know <code>Dispatcher</code> can help, but I don't want to split function.</p>
  
  <p>Is there any command to update UI immediately like..</p>
  
  <pre><code>for (int i = 0; i &lt;= 100; i++) {
      System.Threading.Thread.Sleep(100);
      progressBar1.Value = i;
      UpdateUINow();
  }
  </code></pre>
  
  <p>Edit: I'm using WPF, and I use Thread.Sleep to simulate long running process.</p>
  
  <p>In fact, I want any command liked <code>Application.DoEvents</code>. But I cannot find this command in WPF.</p>