title: populating AutoCompleteBox data from server
body: <p>I'm using AutoCompleteBox to populate data to it from a server. I've tried at first to do this from TextChanged event, but it crashed my app. I also tried to use KeyUp and KeyDown, but these also didnt work.</p>
  
  <p>this is my code:</p>
  
  <pre><code>if (!string.IsNullOrEmpty(txtWhat.Text.Trim()))
  {
       var webClient = new WebClient();
       webClient.DownloadStringCompleted += (s, ea) =&gt;
       {
            List&lt;string&gt; queries = ea.Result.Split(new char[] { '\n' }).ToList&lt;string&gt;();
            Queries.Clear();
            foreach (string str in queries)
                 Queries.Add(str);
       };
       webClient.DownloadStringAsync(new Uri("www.myserver.me"));
   }
  </code></pre>
  
  <p>the Queries is an ObservableCollection which I bind to the itemssource of the AutoCompleteBox</p>