title: Sorting ItemsControl in WPF fastest way
body: <p>Sorting takes a lot of time to finish .
  I am using an ItemsControl WPF element to show a list of items ( An observable Collection) and i want to sort this Observable Collection based on a property
  I used this code for doing the sort operation</p>
  
  <pre><code>        ICollectionView dataView = CollectionViewSource.GetDefaultView(mycontrolName.ItemsSource);
          dataView.SortDescriptions.Clear();
          SortDescription sd = new SortDescription("Property", ListSortDirection.Ascending);
          dataView.SortDescriptions.Add(sd);
          dataView.Refresh();
  </code></pre>
  
  <p>But its taking a lot of time to reflect the changes on UI. Once i click the sort button it took almost 8-10 seconds to render the sorted view . 
  Any idea to improve this perfomance ( My list contains more than 100 items and every list item consists of some images and few text properties ).</p>
  
  <p>The xaml i used is </p>
  
  <pre><code>&lt;ItemsControl  ItemsSource="{Binding ShelfItemsCollection}" Name="shelfGridView" Margin="5" Visibility="Collapsed"VirtualizingStackPanel.IsVirtualizing="True"
  ScrollViewer.CanContentScroll="False"   VirtualizingStackPanel.VirtualizationMode="Recycling"  &gt;
              &lt;ItemsControl.ItemTemplate&gt;
                      &lt;DataTemplate&gt; 
          &lt;Border Style="{StaticResource ResourceKey=shelfBorderStyle}" MinWidth="200"&gt;
    &lt;Stackpanel&gt;
   &lt;Image Width="150" Height="200" Stretch="Fill" Source="{Binding CoverImage}" &gt;&lt;/Image&gt; 
      &lt;TextBlock Text="{Binding Title}"  TextTrimming="CharacterEllipsis"  MaxWidth="150"&gt;&lt;/TextBlock&gt;
     &lt;TextBlock Text="{Binding Info}"  TextTrimming="CharacterEllipsis"  MaxWidth="150"  &gt;&lt;/TextBlock&gt;
   &lt;/StackPanel&gt;
  &lt;/Border&gt; 
  </code></pre>