title: How to Group and Sort Objects in ObjectListView?
body: <p>I am trying to group my list of objects in an <code>ObjectListView</code>.</p>
  
  <p>The <code>ObjectListView</code> should group the objects based on the first column but then have that same column sorted based on a custom sort.</p>
  
  <p>How do I do that? I have read through the documentation for <code>ObjectListView</code>:
  <a href="http://objectlistview.sourceforge.net/cs/gettingStarted.html#gettingstarted" rel="nofollow noreferrer">http://objectlistview.sourceforge.net/cs/gettingStarted.html#gettingstarted</a></p>
  
  <p>So far, I have implemented my custom sort but I am not sure how to trigger the grouping? Remember that I am trying to group on the first column but then apply a custom sort.</p>
  
  <p>My custom sort relis on the <code>BeforeSorting</code> event:</p>
  
  <pre><code>// after initializing components
  olv.BeforeSorting += olv_BeforeSorting;
  </code></pre>
  
  <p>Then...</p>
  
  <pre><code>private void olv_BeforeSorting(object sender,BrightIdeasSoftware.BeforeSortingEventArgs e)
  {
          olvDataSource.Sort((x, y) =&gt; x.Group.ID.CompareTo(y.Group.ID));
          e.Handled = true;
  }
  </code></pre>
  
  <p>The <code>ObjectListView</code> displays my ordered object list but it is not grouped together. Each object displays on its own row without a group heading.</p>
  
  <p>How do I group my objects after sorting them?</p>