ComboBox Text Gets Highlighted & Erased Whenever ItemsSource Changes
<p>I am using a combo box in WPF App such that after 3 characters typed into the Combo Box, it queries SQL to generate a data table, which will then provide my combo box an ItemsSource, after converting that into a list.  I am using LINQ to further filter that list as the user types more than 3 characters into my combo box.  However, whenever the Item Source gets updated, the text in the combo box gets highlighted, and the user who is typing, will erase everything and begin back at 1 character, as expected when you highlight text and begin typing.  Here is the error I am referring to:</p>
<p><a href="https://i.stack.imgur.com/RzQnh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RzQnh.png" alt="Example of my Combo Box" /></a></p>
<blockquote>
<p>(Sorry, values covered up as it is private info)</p>
</blockquote>
<p>So, as you can see, my combo box has its' ItemsSource, but as it has been updated.  However, the next letter I type in my combobox is going to be overwritten because what I have typed, &quot;ANDE&quot; is finding a close match and is being auto highlighted, the blue highlight over &quot;11/2/1979.&quot;  Is there a way to turn this suggestion portion off?</p>
<p>Here is my XAML, in the event that is useful, as well as my update the itemSource code:</p>
<blockquote>
<p>XAML</p>
</blockquote>
<pre><code>&lt;ComboBox x:Name=&quot;patientComboBox&quot; 
    Text=&quot;&quot; HorizontalAlignment=&quot;Left&quot; 
    Margin=&quot;21,36,0,0&quot; VerticalAlignment=&quot;Top&quot;
    Width=&quot;269&quot; IsEditable=&quot;True
    KeyDown=&quot;patientComboBox_KeyDown&quot;
    DropDownClosed=&quot;patientComboBox_DropDownClosed&quot;/&gt;
</code></pre>
<blockquote>
<p>ComboBox_KeyDown</p>
</blockquote>
<pre><code> private async void patientComboBox_KeyDown(object sender, KeyEventArgs e)
    {
        if (patientComboBox.Text.Length &lt; 3)
        {
            PublicVars.data = new System.Data.DataTable();
        }
        else
        {
            PublicVars.patientSearchText = patientComboBox.Text;
            PublicVars.searchComplete = false;
            PublicVars.currentNameSearch = patientComboBox.Text;
            //Dont write over the thread if it is currently running
            if (!worker.IsBusy)
                await Task.Run(() =&gt; worker.RunWorkerAsync());
            //wait for the async to run to continue
            check:
            if (PublicVars.currentNames != null &amp;&amp; PublicVars.searchComplete == true)
                patientComboBox.ItemsSource = PublicVars.currentNames;
            else
            {
                goto check;
            }                
            patientComboBox.IsDropDownOpen = true;
        }
    }
</code></pre>
<blockquote>
<p>Background_Worker_DoWork</p>
</blockquote>
<pre><code>private async void Worker_DoWork(object sender, DoWorkEventArgs e)
    {
        if (PublicVars.data.Rows.Count != 0)
        {
            PublicVars.currentNames = new List&lt;string&gt;();
            await Task.Run(() =&gt; PublicVars.filterList = PublicVars.data.AsEnumerable().Where(x =&gt; x[&quot;LastName&quot;].ToString() == PublicVars.patientSearchText).ToList());      
            foreach(DataRow row in PublicVars.filterList)
            {
                PublicVars.currentNames.Add(row[&quot;LastName&quot;].ToString() + &quot;, &quot; + row[&quot;FirstName&quot;].ToString() + &quot; -- &quot; + row[&quot;DOB&quot;].ToString());
            }

            PublicVars.searchComplete = true;
        }
        else
        {
            PublicVars.topPatients = new List&lt;NameSearchObj&gt;();
            PublicVars.currentNames = new List&lt;string&gt;();
            SqlConnection cnn = new SqlConnection(&quot;...&quot;);
            string sqlCommand = &quot;...&quot;;
            cnn.Open();
            System.Data.DataSet ds = new System.Data.DataSet();
            System.Data.DataTable dtable = new System.Data.DataTable();
            SqlDataAdapter dscmd = new SqlDataAdapter(sqlCommand, cnn);
            dscmd.Fill(dtable);

            foreach (System.Data.DataRow row in dtable.Rows)
            {
                PublicVars.topPatients.Add(new NameSearchObj(row[&quot;LastName&quot;].ToString() + &quot;, &quot; + row[&quot;FirstName&quot;].ToString() + &quot; -- &quot; + row[&quot;DOB&quot;].ToString(), row[&quot;PtKey&quot;].ToString()));
            }

            foreach (NameSearchObj searcher in PublicVars.topPatients)
            {
                string[] convertName = searcher._nameDOBCombo.Split(' ');
                string finalName = convertName[0] + &quot; &quot; + convertName[1] + &quot; &quot; + convertName[2] + &quot; &quot; + convertName[3];
                PublicVars.currentNames.Add(finalName);
            }

            PublicVars.data = dtable;
            PublicVars.searchComplete = true;
        }            
    }
</code></pre>