title: C# WPF Cmb Text in Textfield with Thread
body: <p>I´m using the BusyIndicator in my GUI because I have to work with a database that the GUI don´t freeze meanwhile.</p>
  
  <pre><code>private void btnSearch_Click(object sender, RoutedEventArgs e)
  {
      richSammelbemerkung.Document.Blocks.Clear();
      richSammelbemerkung.AppendText("Daten werden gesucht...");
      GUIData guiData = new GUIData();
      guiData = getInfoFromGUI();
      ZeichnungCollection zeichnungen = new ZeichnungCollection();
      BackgroundWorker worker = new BackgroundWorker();
      busyIndicator.IsBusy = true;
      worker.DoWork += (o, ea) =&gt;
      {
          zeichnungen = searchDrawings(guiData);
      };
      worker.RunWorkerCompleted += (o, ea) =&gt;
      {
          Application.Current.Dispatcher.Invoke((Action)(() =&gt; CollectionViewSource.GetDefaultView(dataOutOfDb.ItemsSource = zeichnungen).Refresh()));
          busyIndicator.IsBusy = false;
          if (zeichnungen.Count == 0)
          {
              MessageBox.Show("Keine Daten gefunden. Eventuell Index überprüfen.", "Info");
          }
          richSammelbemerkung.Document.Blocks.Clear();
          dataOutOfDb.SelectedIndex = 0;
          Keyboard.Focus(dataOutOfDb);
      };
  
      busyIndicator.IsBusy = true;
      worker.RunWorkerAsync();
  }
  </code></pre>
  
  <p>It´s look like this.
  Before I put the BusyIndicator into my GUI I just run the code and used the SelectionChanged of the Cmb to set the selected Text into a Textfield.
  The problem I have now is, that when the SelectionChanged is fired it throws a Exception even if I used a IF to ask for elements.
  So I went on with DataBinding like this:</p>
  
  <pre><code>Text="{Binding ElementName=cmbTag, Path=SelectedItem}"
  </code></pre>
  
  <p>Now when it doesn´t throw a exception or anything else.
  BUT, I can´t set a new value in the Textfield because it automatically refreshes on what is selected in the Combobox.
  So, has anyone an idea how I can set the selected value from the Cmb to the Textfield without using SelectionChanged or DataBinding, or even so that it doens´t throw a exception?</p>