title: WPF DataGrid default sort not working
body: <p>I have a DataGrid, with columns XAML as such:</p>
  
  <pre><code>&lt;DataGridTextColumn Header="Time" Binding="{Binding Date, StringFormat='yyyy-MM-dd  HH:mm:ss'}" SortMemberPath="Date" SortDirection="Descending" Width="130" CanUserResize="True" /&gt;
  &lt;DataGridTextColumn Header="Level" Binding="{Binding Level}" Width="60" CanUserResize="True" /&gt;
  &lt;DataGridTextColumn Header="Source" Binding="{Binding Logger}" Width="150" CanUserResize="True" /&gt;
  &lt;DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="*" CanUserResize="True" /&gt;
  </code></pre>
  
  <p>I bind this to an <code>ObservableCollection&lt;EalsLogEvent&gt;</code>, where <code>EalsLogEvent.Date</code> is typed <code>DateTime</code>:</p>
  
  <pre><code>public ObservableCollection&lt;EalsLogEvent&gt; LogEvents 
  {
      get
      {
          return _logEvents;
      }
  }
  </code></pre>
  
  <p>The grid viewmodel uses a timer to refresh itself, and everything seems fine with the grid, except when it first loads, on app startup. Then, the <code>Time</code> column appears to be sorted descending, but is sorted ascending. </p>
  
  <p>To get the sort right, I must click the column header twice; the first time changes the order to ascending, which now matches the content of the column. The second click on the column header changes its sort order back to descending, and this time it sorts the column contents properly, i.e. descending.</p>
  
  <p>If I use LINQ to order the collection when <code>_logEvents</code> gets refreshed, I lose whichever order the user had set for the column by clicking its header. If I have to have the view tell the model which order the LINQ sort should use, something smells bad.</p>