title: Problems with ComboBox used for showing suggestions
body: <p>I’m trying to implement suggestions ComboBox like Google’s one:</p>
  
  <p><img src="https://i.stack.imgur.com/eiEbD.png" alt=""></p>
  
  <p>User enters several symbols and a list with suggestions appears. 
  So I have the following code:</p>
  
  <pre><code> &lt;!--Search query textBox--&gt;
      &lt;ComboBox x:Name="txtMain" IsEditable="True"                                         TextBoxBase.SelectionChanged="txtMain_SelectionChanged"
      TextBoxBase.TextChanged=" txtMain_TextChanged"
      KeyDown="txtMain_PreviewKeyDown"
      SelectionChanged=" txtMain_SelectionChanged"                                              IsTextSearchEnabled="False" /&gt;
  
     public SearchControl()
      {
          InitializeComponent();
  
          _search = new SearchViewModel(doc);
  
          _suggestionCom = new SuggestionsCommand(
              (object s, RunWorkerCompletedEventArgs evarg) =&gt;
              {
                  List&lt;string&gt; results = _suggestionCom.Suggestions;
  
                  if (results != null &amp;&amp; results.Count() &gt; 0)
                  {
                      txtMain.ItemsSource = results;
                  }
                  else
                  {
                      txtMain.ItemsSource = null;
                  }
                  txtMain.IsDropDownOpen = true;
              });
      }
     void autoTextBox_TextChanged(object sender, TextChangedEventArgs e)
      {
          try
          {
              if (_prevText.Equals(txtMain.Text))
                  return;
              // Only autocomplete when there is text
              if (txtMain.Text.Length &gt; 0)
              {
                  string lastInput = txtMain.Text;
                  _prevText = lastInput;
                  _suggestionCom.Execute(lastInput); //it starts a new thread which download suggestions from the service
              }
              else
              {
                  txtMain.ItemsSource = null;
              }
          }
          catch (Exception err)
          {
          }
      }
  
      void txtMain_PreviewKeyDown(object sender, KeyEventArgs e)
      {
          if (e.Key == Key.Down)
          {
              if (txtMain.SelectedIndex &lt; txtMain.Items.Count)
              {
                  txtMain.SelectedIndex = txtMain.SelectedIndex + 1;
              }
          }
          if (e.Key == Key.Up)
          {
              if (txtMain.SelectedIndex &gt; -1)
              {
                  txtMain.SelectedIndex = txtMain.SelectedIndex - 1;
              }
          }
          if (e.Key == Key.Enter)
          {
              // Commit the selection
              //txtMain.Visibility = Visibility.Collapsed;
              e.Handled = (e.Key == Key.Enter);
              //Perform search here
          }
  
          if (e.Key == Key.Escape)
          {
              // Cancel the selection
              txtMain.ItemsSource = null;
              //suggestionListBox.Visibility = Visibility.Collapsed;
          }
      }
  </code></pre>
  
  <p>Lambda described in the constructor is called when suggestions have been downloaded.
  I have the following problems with this code. First, I can’t handle Key.Down (txtMain_PreviewKeyDown is not called when it is pressed). So in order to choose suggestion from a list user need to use mouse. Second, when some suggestions have been found and list has been dropped the text in ComboBox becomes selected (blue) which is not what I want(I don't want to have the text beeing selected when suggestion have been chosen):
  <img src="https://i.stack.imgur.com/E4a3p.png" alt=""></p>