title: IComparer sort on databound Datagridview
body: <p>I have a data-bound DataGridView that I am trying to sort using an IComparer. </p>
  
  <p>When I try to apply my sort I get this error:</p>
  
  <blockquote>
    <p>DataGridView control is data-bound. The control cannot use the comparer to perform the sort operation.</p>
  </blockquote>
  
  <p>My sorting technique was based off <a href="http://msdn.microsoft.com/en-us/library/ms171608.aspx" rel="nofollow">this link</a>.</p>
  
  <p>Just an FYI I am trying to compare Bitmaps by using their tag values. </p>
  
  <pre><code>public int Compare(object x, object y)
  {
      DataGridViewRow DataGridViewRow1 = (DataGridViewRow)x;
      DataGridViewRow DataGridViewRow2 = (DataGridViewRow)y;
  
      // Try to sort based on the tag 
      int CompareResult = System.String.Compare(
          DataGridViewRow1.Cells[1].Tag.ToString(),
          DataGridViewRow2.Cells[1].Tag.ToString());
  
  
  
      return CompareResult * sortOrderModifier;
  }
  </code></pre>