title: How to show a waitcursor when the WPF application is busy databinding
body: <p>I have a WPF application using the MVVM pattern that sometimes have to show a waitcursor when it is busy doing something the user has to wait for. Thanks to a combination of answers on this page: <a href="https://stackoverflow.com/questions/3480966/display-hourglass-when-application-is-busy">display Hourglass when application is busy</a>, I have a solution that almost works (although it is not really MVVM in spirit).
  Whenever I do something time-consuming in my viewmodels I do this:</p>
  
  <pre><code>using (UiServices.ShowWaitCursor())
  {
  .. do time-consuming logic
  this.SomeData = somedata;
  }
  </code></pre>
  
  <p>(ShowWaitCursor() returns a IDisposable that shows the waitcursor until it is being disposed of)
  The last line in my example is where I set some property. This property is bound in my XAML, e.g. like this:</p>
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding SomeData}" /&gt; 
  </code></pre>
  
  <p>However, since this could be a long list of objects and sometimes with complex datatemplates, etc. the actual binding and rendering sometime takes a considerable amount of time. Since this binding takes places outside of my using statement the waitcursor will go away before the actual wait is over for the user.</p>
  
  <p>So my question is how to do a waitcursor in a WPF MVVM application that takes databinding into account?</p>