title: How to use Progressbar in MVVM
body: <p>I'm really stuck on this. I searched a lot in the net but actually nothing helped me. In my view I have one button and the progressbar, when the user click on button it does different work and after increase the <em>CurrentProgress</em>.</p>
  
  <p>But it shows to user only in the end of Work the 100% in the end and is not what i want. I would like that eachtime that the <em>CurrentProgress</em> is increased it shows and display to the view.</p>
  
  <p>The controls in the view are those:</p>
  
  <pre><code>&lt;Button x:Name="Generate" Content="Generate" /&gt;
  &lt;ProgressBar  Value="{Binding Path=CurrentProgress, Mode=OneWay}" Width="80" Height="15"/&gt;
  </code></pre>
  
  <p>And this is the code in the ViewModel</p>
  
  <pre><code>private int currentProgress;
  public int CurrentProgress
  {
      get { return currentProgress; }
      set
      {
          if (currentProgress == value)       
              return;
  
          currentProgress = value;
          NotifyOfPropertyChange(() =&gt; CurrentProgress);
      }
  }
  
  List&lt;Article&gt; articles;
  
  
  public void Generate()
  {
      foreach (var art in articles)
      {       
          //[..]
          //Insert article                    
  
          inserted++;
  
          Task.Factory.StartNew(() =&gt;updateProgress(inserted));                    
      }
  
  }
  
  
  private void updateProgress(int Analyzed)
  {
      if (Analyzed != 0)
      {
          int percentage = 100 * Analyzed / articles.Count;
          CurrentProgress = percentage;
      }   
  }
  </code></pre>
  
  <p>How to fix the issue?. Thanks to all in advance!</p>