title: WPF DataGrid column header sort arrow disappear after changing the source of its view collection source
body: <p>I have the following simple code that I can reproduce this problem:</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;DataGrid ItemsSource="{Binding Source.View}"
            AutoGenerateColumns="False"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="Name"
                              Binding="{Binding Name}"
                              SortMemberPath="Name"
                              SortDirection="Ascending"/&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>View Model:</p>
  
  <pre><code>private readonly ObservableCollection&lt;Data&gt; _collection1 = new ObservableCollection&lt;Data&gt; {new Data("item 1"), new Data("item 2")};
  private readonly ObservableCollection&lt;Data&gt; _collection2 = new ObservableCollection&lt;Data&gt; {new Data("person 1"), new Data("person 2")};
  
  public MainViewModel()
  {
      Source.Source = _collection1;
  
      // Set up a timer that runs 5 seconds.
      Observable.Timer(TimeSpan.FromSeconds(5)).ObserveOn(AsyncOperationManager.SynchronizationContext).Subscribe(_ =&gt;
      {
          // Get existing sort descriptions.
          var existingSortDescription = Source.View.SortDescriptions.ToList();
  
          // Change source.
          Source.Source = _collection2;
  
          // This has to be done in order to maintain the sort order.
          existingSortDescription.ForEach(Source.SortDescriptions.Add);
      });
  }
  
  public CollectionViewSource Source { get; } = new CollectionViewSource();
  
  private class Data
  {
      public Data(string name)
      {
          Name = name;
      }
  
      public string Name { get; }
  }
  </code></pre>
  
  <p>So what the above code does is, that when the app starts, use <code>_collection1</code> as the source of the items source of the data grid to begin with.</p>
  
  <p>After 5 seconds, change the items source of the data grid to <code>_collection2</code>.</p>
  
  <p>If you run the above code, the sort direction arrow in the "Name" column header will disappear as soon as the source is changed to <code>_collection2</code>, but the sorting is still correct.</p>
  
  <p>Is this a bug in WPF <code>DataGrid</code> control or I'm missing something here?</p>