title: How to set the visibility of a ProgessBar in WPF?
body: <p>I just recently began working with WPF and am trying to implement a ProgressBar but can't get it to do what I want.</p>
  
  <p>All I want is for the UI to show the progress bar while a task is occurring, but it should not be visible otherwise.</p>
  
  <p>This what I have in the xaml:</p>
  
  <pre><code>&lt;ProgressBar x:Name="pbarTesting" HorizontalAlignment="Left" Height="37"
      Margin="384,301,0,0" VerticalAlignment="Top" Width="264" IsHitTestVisible="True"
      IsIndeterminate="True" Visibility="Collapsed"/&gt;
  </code></pre>
  
  <p>And in the application I wrote:</p>
  
  <pre><code>progressBar.Visibility = Visibility.Visible;
  doTimeConsumingStuff();
  progressBar.Visibility = Visibility.Hidden;
  </code></pre>
  
  <p>However, when I get to the time consuming stuff, the progress bar never shows up. Can anyone tell me what I'm doing wrong?</p>