title: UserInterface freezes when BackgroundWorker is working
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Windows;
  using System.Windows.Input;
  using System.Windows.Media.Imaging;
  
  namespace IMDBWpf
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      /// 
      public partial class MainWindow : Window
      {
          private List&lt;Movie&gt; movieList;
          BackgroundWorker bgWorker;
          private string searchText;
  
          public MainWindow()
          {
              InitializeComponent();
  
              bgWorker = new BackgroundWorker();
              bgWorker.DoWork += bgWorker_doWork;
              bgWorker.RunWorkerCompleted += bgWorker_Completed;
          }
  
          private void bgWorker_Completed(object sender, RunWorkerCompletedEventArgs e)
          {
              Dispatcher.Invoke(() =&gt;
              {
                  movieList = new Movies(searchText).movieList;
                  searchBar.ItemsSource = movieList;
              });
          }
  
          private void bgWorker_doWork(object sender, DoWorkEventArgs e)
          {
              Dispatcher.Invoke(() =&gt;
              {
                  var loadingMovie = new Movie("src\\loader.gif", "Loading...");
                  movieList = new List&lt;Movie&gt;();
                  movieList.Add(loadingMovie);
                  searchBar.ItemsSource = movieList;
                  searchBar.IsDropDownOpen = true;
              });
          }
  
          private void searchBar_DataContextChanged(object sender, RoutedEventArgs e)
          {
              searchText = searchBar.Text;
  
              if(!bgWorker.IsBusy)
                  bgWorker.RunWorkerAsync();
          }
      }
  }
  </code></pre>
  
  <p>I have a comboBox. Each element from combobox have a label and a image.</p>
  
  <p>The comboBox is filled with elements from a webpage, process that takes some time until it's done. </p>
  
  <p>The main problem is that when I write something in comboBox(yes, it's editable), my app freezes until the list with elements is created. To get rid of this freeze I tried to use BackgroundWorker, but it's not working...Any ideas why?
  I tried to use threading on the class that generates the list, but nothing happens.</p>
  
  <pre><code>using HtmlAgilityPack;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading;
  using System.Threading.Tasks;
  
  namespace IMDBWpf
  {
      struct Movie
      {
          public Movie(string movieImg, string movieT)
          {
              movieTitle = movieT;
              movieImage = movieImg;
          }
          public string movieTitle { get; set; }
          public string movieImage { get; set; }
      }
  
      class Movies
      {
          public List&lt;Movie&gt; movieList { get; set; }
          public Movies(string movieName)
          {
              if (movieName.Length &gt; 0)
              {
                  populateList(movieName);
              }
          }
  
          private void populateList(string movieName)
          {
              var webSite = new HtmlAgilityPack.HtmlWeb();
              var siteAddress = "http://www.imdb.com/find?ref_=nv_sr_fn&amp;q=" + movieName + "&amp;s=tt";
              HtmlDocument htmlPage = webSite.Load(siteAddress);
              movieList = new List&lt;Movie&gt;();
              int index = 0;
  
              while (htmlPage.DocumentNode.Descendants("td").ElementAt(index).Descendants("a").Any())
              {
                  var movie = new Movie();
  
                  movie.movieImage = htmlPage.DocumentNode.Descendants("td").ElementAt(index++).Descendants("a").ElementAt(0).Descendants("img").ElementAt(0).GetAttributeValue("src", "");
                  movie.movieTitle = htmlPage.DocumentNode.Descendants("td").ElementAt(index++).InnerText;
  
                  movieList.Add(movie);
              }
          }
      }
  }
  </code></pre>