title: WPF UI is not updating
body: <p>I have developed a simple wpf application using MVVM model and code as below.I debug the code and found that collection is updating but UI is not updating even I don't see any record in listbox.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><img src="https://i.stack.imgur.com/xQUcw.jpg" alt="enter image description here"></p>
  
  <pre><code>&lt;Window x:Class="Model.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="WPF Dispatcher Demo" Height="350" Width="525"&gt;
  
  
      &lt;DockPanel&gt;
          &lt;Grid DockPanel.Dock="Bottom"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="2*" Name="col0" /&gt;
                  &lt;ColumnDefinition Width="*" /&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;TextBox Name="textBlock1" Text="{Binding ShowPath}" 
                   VerticalAlignment="Center" HorizontalAlignment="Left" 
                    Margin="30" Grid.Column="0" /&gt;
              &lt;Button Name="FindButton" Content="Select Path" 
                Width="100" Margin="20" Click="FindButton_Click" Grid.Column="1" /&gt;
          &lt;/Grid&gt;
          &lt;ListBox Name="listBox1"  ItemsSource="{Binding Path=Files}"/&gt;
  
  
      &lt;/DockPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.IO;
  using System.Windows.Threading;
  using System.ComponentModel;
  using System.Collections.ObjectModel;
  
  
  namespace Model
  {
      public class DirectorySearchModel : INotifyPropertyChanged
      {
          private ObservableCollection&lt;string&gt; _files = new ObservableCollection&lt;string&gt;();
          private string _showPath;
          public DirectorySearchModel() { }
          void ShowCurrentPath(string path)
          {
              ShowPath = path;
          }
  
  
          void AddFileToCollection(string file)
          {
              _files.Add(file);
          }
          public void Search(string path, string pattern)
          {
  
              if (System.Windows.Application.Current.Dispatcher.CheckAccess())
                  ShowPath = path;
              else
                  System.Windows.Application.Current.Dispatcher.Invoke(
                    new Action&lt;string&gt;(ShowCurrentPath), DispatcherPriority.Background, new string[] { path }
                  );
              string[] files = Directory.GetFiles(path, pattern);
              foreach (string file in files)
              {
                  if (System.Windows.Application.Current.Dispatcher.CheckAccess())
                      Files.Add(file);
                  else
                      System.Windows.Application.Current.Dispatcher.Invoke(new Action&lt;string&gt;(AddFileToCollection), DispatcherPriority.Background,
                        new string[] { file }
                      );
              }
              string[] dirs = System.IO.Directory.GetDirectories(path);
              foreach (string dir in dirs)
                  Search(dir, pattern);
          }
  
          public string ShowPath
          {
              get
              {
                  return _showPath;
              }
              set
              {
                  _showPath = value;
                  OnPropertyChanged("ShowPath");
              }
          }
          public ObservableCollection&lt;string&gt; Files
          {
              get
              {
                  return _files;
              }
              set
              {
                  _files = value;
                  OnPropertyChanged("Files");
              }
          }
          public void OnPropertyChanged(string name)
          {
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs(name));
  
              }
          }
          public event PropertyChangedEventHandler PropertyChanged;
      }
  }
  </code></pre>
  
  <p>MainWindow.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  using System.Windows.Forms;
  using System.IO;
  
  namespace Model
  {
      public partial class MainWindow : Window
      {
          IAsyncResult cbResult;
          public MainWindow()
          {
              InitializeComponent();
              this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
  
          }
          void MainWindow_Loaded(object sender, RoutedEventArgs e)
          {
              this.DataContext = new DirectorySearchModel().Files;
          }
  
          private void FindButton_Click(object sender, RoutedEventArgs e)
          {
  
              FolderBrowserDialog dlg = new FolderBrowserDialog();
              string path = AppDomain.CurrentDomain.BaseDirectory;
              dlg.SelectedPath = path;
              DialogResult result = dlg.ShowDialog();
              if (result == System.Windows.Forms.DialogResult.OK)
              {
                  path = dlg.SelectedPath;
                  string pattern = "*.*";
                  new Model.DirectorySearchModel().Search(path, pattern);
                  Action&lt;string, string&gt; proc = new Model.DirectorySearchModel().Search;
                  cbResult = proc.BeginInvoke(path, pattern, null, null);
  
              }
          }
      }
  }
  </code></pre>