title: BackgroundWOrker Invalid cross-thread access
body: <p>I try to add loading datamodel and load items to listbox on another thread because loading of 50 items to listbox takes long time (about 5 seconds).</p>
  
  <p>I have problem with BackgroundWorker it show me error Invalid cross-thread access</p>
  
  <p>His is code of Inbox.xaml</p>
  
  <pre><code>    public Inbox()
      {
          InitializeComponent();
  
          DataContext = App.ViewModel;
      }
  
      protected override void OnNavigatedTo(NavigationEventArgs e)
      {
          ProgressIndicator progress = new ProgressIndicator
          {
              IsVisible = true,
              IsIndeterminate = true,
              Text = "Načítání"
          };
  
          SystemTray.SetProgressIndicator(this, progress);
          SystemTray.IsVisible = true;
  
          BackgroundWorker backgroundWorker = new BackgroundWorker();
          backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
          backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
  
          backgroundWorker.RunWorkerAsync();
      }
  
      private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
      {
          LoadData();
      }
  
      void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
      {
          if (e.Error != null)
          {
              MessageBox.Show(e.Error.Message);
          }
          else
          {
              SystemTray.IsVisible = false;
          }
      }
  
      private void LoadData()
      {
          try
          {
              (this.DataContext as MainViewModel).LoadInboxData();
          }
          finally
          {
              TasksListBox.ItemsSource = (this.DataContext as MainViewModel).Tasks;
          }
      }
  </code></pre>
  
  <p>What am I doing wrong?</p>