title: Problem in use of SortDescription in WPF - int and string are not IComparable?
body: <p>I have a problem in using SortDescription. I've found some thread about the problem, like if you want to sort by a type that doesn't implement IComparable, like a user defined class, but it's not my case.</p>
  
  <p>I have a class, that has two properties: string ID, and int Value. Let's call it Item!
  And I have a view:</p>
  
  <pre><code>&lt;UserControl&gt; &lt;!-- ... --&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition/&gt;
              &lt;RowDefinition/&gt;
              &lt;RowDefinition/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;Button Click="Button_Click"
                  Content="Sort by ID"
                  Grid.Row="0"/&gt;
          &lt;Button Click="Button_Click1"
                  Content="Sort by Value"
                  Grid.Row="1"/&gt;
          &lt;DockPanel Grid.Row="2"&gt;
              &lt;ItemsControl x:Name="mItemsControl"
                            ItemsSource="{Binding Items}"&gt;&lt;!-- The type of Items is ObservableCollection&lt;Item&gt; --&gt;
                  &lt;!-- ... --&gt;
              &lt;/ItemsControl&gt;
          &lt;/DockPanel&gt;
      &lt;/Grid&gt;
  &lt;/GroupBox&gt;
  </code></pre>
  
  <p>
  EventHandlers are like these:</p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
      {
          mItemsControl.Items.SortDescriptions.Add(new SortDescription("ID", ListSortDirection.Ascending); //Exception here
      }
  private void Button_Click1(object sender, RoutedEventArgs e)
      {
          mItemsControl.Items.SortDescriptions.Add(new SortDescription("Value", ListSortDirection.Ascending); //...and here as well
      }
  </code></pre>
  
  <p>I get InvalidOperationException because it "Failed to compare two elements in the array.", and it is because neither of the elements implement IComparable.
  And that is, what I can't understand, as I can compare ints, as well as strings.</p>
  
  <p>Thanks for any idea!</p>