# C1.Win.FlexGrid.GridTree.Sort

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_GridTree_Sort_" data-uid="C1.Win.FlexGrid.GridTree.Sort*">Sort Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_GridTree_Sort_" data-uid="C1.Win.FlexGrid.GridTree.Sort*"></a>
<h4 id="C1_Win_FlexGrid_GridTree_Sort_System_Int32_C1_Win_FlexGrid_SortFlags_System_Int32_System_Int32_" data-uid="C1.Win.FlexGrid.GridTree.Sort(System.Int32,C1.Win.FlexGrid.SortFlags,System.Int32,System.Int32)">Sort(int, SortFlags, int, int)</h4>
<div class="markdown level1 summary"><p>Sorts all nodes at the given level.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Sort(int level, SortFlags order, int col1, int col2)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Sort(level As Integer, order As SortFlags, col1 As Integer, col2 As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">level</span></td>
      <td><p>Level of the nodes to sort.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.SortFlags.html">SortFlags</a></td>
      <td><span class="parametername">order</span></td>
      <td><p><a class="xref" href="C1.Win.FlexGrid.SortFlags.html">SortFlags</a> value that controls sort direction and options.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">col1</span></td>
      <td><p>Start of the range of columns to sort.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">col2</span></td>
      <td><p>End of the range of columns to sort.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_GridTree_Sort_System_Int32_C1_Win_FlexGrid_SortFlags_System_Int32_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. This method only sorts the row nodes; it does not reorder the data rows within each node.</p>
<p>To sort the data rows, use the grid's <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.Sort.html#C1_Win_FlexGrid_C1FlexGridBase_Sort_C1_Win_FlexGrid_SortFlags_System_Int32_">Sort(SortFlags, int)</a> method instead.</p>
</div>


<a id="C1_Win_FlexGrid_GridTree_Sort_" data-uid="C1.Win.FlexGrid.GridTree.Sort*"></a>
<h4 id="C1_Win_FlexGrid_GridTree_Sort_System_Int32_System_Collections_IComparer_" data-uid="C1.Win.FlexGrid.GridTree.Sort(System.Int32,System.Collections.IComparer)">Sort(int, IComparer)</h4>
<div class="markdown level1 summary"><p>Sorts all nodes at the given level using the specified comparer.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Sort(int level, IComparer comparer)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Sort(level As Integer, comparer As IComparer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">level</span></td>
      <td><p>Level of the nodes to sort.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.icomparer">IComparer</a></td>
      <td><span class="parametername">comparer</span></td>
      <td><p>An <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.icomparer">IComparer</a> object that compares <a class="xref" href="C1.Win.FlexGrid.Node.html">Node</a> objects.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
