title: UWP/C#: ObservableCollection sort in-place (w/o scrolling)
body: <p>In an UWP app I'm trying to sort an <code>ObservableCollection</code> that is bound to a <code>ListView</code> - therefore <code>collection.OrderBy(..)</code> (which creates a new collection) is not an option.</p>
  
  <p>Until now I used this extension-method:</p>
  
  <pre><code>public static void Sort&lt;TSource, TKey&gt;(this 
  ObservableCollection&lt;TSource&gt; source, Func&lt;TSource, TKey&gt; keySelector)
  {
      List&lt;TSource&gt; sortedList = source.OrderBy(keySelector).ToList();
      source.Clear();
      foreach (var sortedItem in sortedList)
      {
          source.Add(sortedItem);
      }
  }
  </code></pre>
  
  <p>Unfortunately this way the current 'scrolling-offset' is resetted due to  <code>source.Clear()</code> and the corresponding <code>ListView</code> scrolls all the way back to the top - which is pretty bad user-experience.</p>
  
  <p>Any ideas?</p>