title: Increasing WPF ObservableCollection performance
body: <p>At present I have two WPF listboxes imitating the following functionality</p>
  
  <p><a href="https://i.stack.imgur.com/uMUyy.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uMUyy.gif" alt="Word 2007 customize screen"></a><br>
  <sub>(source: <a href="http://tlt.its.psu.edu/suggestions/international/graphics/vista/WordCustomize.gif" rel="nofollow noreferrer">psu.edu</a>)</sub>  </p>
  
  <p>I am using 2 ObservableCollections to allow users to select whatever items they require (flexibility is the key here). The main issue is that I have <em>thousands</em> of items that are grouped in both listboxes. All in all the design works really well (with a few dozen items), but my stumbling block is when a user copies all the available items from the left to the right as the screen freezes (time to run on a different thread?).</p>
  
  <p>Looking at ObservableCollection it lacks an AddRange method and there are various implementations available on the internet. I also know the CollectionChanged event is needlessly being fired as each item is copied over draining performance horribly.</p>
  
  <p>It may well be that I have to allow users to choose from groups of over 10 000 items in the future, which sounds like a bad idea, but is non-negotiable as the grouping on the listbox (CollectionViewSource) works really well, but has the side effect of switching <em>off</em> the Virtualising of both the listboxes</p>
  
  <p>What can I do to improve the performance when loading a listbox with thousands of items when databound to an ObservableCollection? Are there any AddRange type implementations that you would recommend? Is the only choice I have here to run this on a background thread which seems expensive because I am not loading data from a database? </p>