# C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns*">AutoSizeColumns Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns*"></a>
<h4 id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_System_Int32_System_Int32_System_Double_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns(System.Int32,System.Int32,System.Double)">AutoSizeColumns(int, int, double)</h4>
<div class="markdown level1 summary"><p>Resizes a column range to fit their visible content.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void AutoSizeColumns(int startCol, int endCol, double extra)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AutoSizeColumns(startCol As Integer, endCol As Integer, extra As Double)</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">startCol</span></td>
      <td><p>Index of the first column to resize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">endCol</span></td>
      <td><p>Index of the last column to resize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">extra</span></td>
      <td><p>Extra width to add to the column, in pixels.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns*"></a>
<h4 id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_System_Int32_System_Int32_System_Double_System_Boolean_System_Boolean_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.AutoSizeColumns(System.Int32,System.Int32,System.Double,System.Boolean,System.Boolean)">AutoSizeColumns(int, int, double, bool, bool)</h4>
<div class="markdown level1 summary"><p>Resizes a column range to fit their content.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void AutoSizeColumns(int startCol, int endCol, double extra, bool allCells, bool skipStars)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AutoSizeColumns(startCol As Integer, endCol As Integer, extra As Double, allCells As Boolean, skipStars As Boolean)</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">startCol</span></td>
      <td><p>Index of the first column to resize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">endCol</span></td>
      <td><p>Index of the last column to resize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">extra</span></td>
      <td><p>Extra width to add to the column, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">allCells</span></td>
      <td><p>Whether to measure all cells, including those that are not currently visible.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">skipStars</span></td>
      <td><p>Whether to skip star-sized columns.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_WPF_FlexGrid_C1FlexGrid_AutoSizeColumns_System_Int32_System_Int32_System_Double_System_Boolean_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Setting the <code class="paramref">allCells</code> parameter to true causes the grid to create and
measure cell elements for the entire grid content, including rows and columns that are
not currently visible. This option may be very time consuming if the grid contains a
lot of data.</p>
</div>
</div>
