Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure why you need the performance boost in the first place, you're trying to calculate the elements that should be in the Autocomplete box in another thread and then assign them to the <code>ItemsSource</code> property of the Control. Something similar is what the AutoCompleteBox should do.</p> <p>I tryed bind the control to a list with 10000 strings and it works perfect, so your problem could be the size of the objects that you're putting in the collection. One solution could be use just a string representation and then when you need the selected object you could find it based on it's representation, assuming that is unique (if not you could put some sort of ID). </p> <p>One of the main problems with this approach is the thread sincronization, i will explain now why you get the extrange behavior where even when the filter is fine the items in the results are not right.</p> <blockquote> <p>The filter seems to be OK but I can run the app once and result X will be there but result Y wont. Running it again can make result Y be there and not X, subsequent times both X and Y will be there, etc, etc.</p> </blockquote> <p>Suppose that you write "ab" in the autocomplete box, this will start a new <code>BackGroundWorker</code> where this search is performed. Everything should be fine if you wait long enough. But if you change the search query before the first worker has finished, now all the results will be mixed. Take for example the following lines of code:</p> <pre><code>// the user searchs for "ab" [Thread 1] Results.Clear(); [Thread 1] Results.Add(Item[1]); [Thread 1] Results.Add(Item[2]); ... // the user changes the search term (to "abc" for example) [Thread 2] Results.Clear(); [Thread 2] Results.Add(Item[3]); // but what would happen if the first BackGroundWorker hasn't finished yet, // this means that the first thread is still running [Thread 1] Results.Add(Item[5]); // this items doesn't match the second search [Thread 1] Results.Add(Item[6]); // criteria, but are added to the collection [Thread 2] Results.Add(Item[7]); // then you'll have two treads adding items to the Result collection [Thread 1] Results.Add(Item[2]); ... [Dispatcher Thread] autGlobal.ItemsSource = Results; [Dispatcher Thread] autGlobal.PopulateComplete(); </code></pre> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload