title: WPF listbox dynamically populated - how to get it to refresh?
body: <p>I am new to WPF, so I thought this was simple. I have a form with a listbox and a button. In the click handler for the button I do something iteratively that generates strings, which I want to put in the listbox as I get them. The xaml for the list box is like</p>
  
  <pre><code>    &lt;ListBox Height="87" Margin="12,0,12,10" Name="lbxProgress" VerticalAlignment="Bottom"&gt;
          &lt;ListBox.BindingGroup&gt;
              &lt;BindingGroup Name="{x:Null}" NotifyOnValidationError="False" /&gt;
          &lt;/ListBox.BindingGroup&gt;
      &lt;/ListBox&gt;
  </code></pre>
  
  <p>and the click handler is like</p>
  
  <pre><code>private void btn_Click(object sender, RoutedEventArgs e)  
  {  
    List&lt;String&gt; lstrFiles= new List&lt;String&gt;(System.IO.Directory.GetFiles   ("C:\\temp", "*.tmp");  
  
    foreach(string strFile in lstrFiles)  
      lbxProgress.Items.Add(strFile);  
  }  
  </code></pre>
  
  <p>Pretty straightforward. Since my real operation is lengthy, I want the listbox to update as I do each one - how do I get the box to dynamically update on each addition?</p>