# C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_TreeView_C1TreeView_GetColumnPreferredWidth_" data-uid="C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth*">GetColumnPreferredWidth Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_TreeView_C1TreeView_GetColumnPreferredWidth_" data-uid="C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_GetColumnPreferredWidth_System_Int32_" data-uid="C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth(System.Int32)">GetColumnPreferredWidth(int)</h4>
<div class="markdown level1 summary"><p>Calculates the minimum width of the <a class="xref" href="C1.Win.TreeView.C1TreeColumn.html">C1TreeColumn</a> that will fit the currently displayed content.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int GetColumnPreferredWidth(int columnIndex)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function GetColumnPreferredWidth(columnIndex As Integer) 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">columnIndex</span></td>
      <td><p>The index of the column whose preferred width is to be calculated.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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><p>The minimum width of the  <a class="xref" href="C1.Win.TreeView.C1TreeColumn.html">C1TreeColumn</a> in <a class="xref" href="C1.Win.TreeView.C1TreeView.Columns.html#C1_Win_TreeView_C1TreeView_Columns">Columns</a> with given columnIndex that will fit the currently displayed content.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.indexoutofrangeexception">IndexOutOfRangeException</a></td>
      <td><p>Thrown if columnIndex is outside of the <a class="xref" href="C1.Win.TreeView.C1TreeView.Columns.html#C1_Win_TreeView_C1TreeView_Columns">Columns</a> bounds.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_TreeView_C1TreeView_GetColumnPreferredWidth_" data-uid="C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_GetColumnPreferredWidth_C1_Win_TreeView_C1TreeColumn_" data-uid="C1.Win.TreeView.C1TreeView.GetColumnPreferredWidth(C1.Win.TreeView.C1TreeColumn)">GetColumnPreferredWidth(C1TreeColumn)</h4>
<div class="markdown level1 summary"><p>Calculates the minimum width of the <a class="xref" href="C1.Win.TreeView.C1TreeColumn.html">C1TreeColumn</a> that will fit the currently displayed content.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int GetColumnPreferredWidth(C1TreeColumn treeColumn)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function GetColumnPreferredWidth(treeColumn As C1TreeColumn) 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="C1.Win.TreeView.C1TreeColumn.html">C1TreeColumn</a></td>
      <td><span class="parametername">treeColumn</span></td>
      <td><p><a class="xref" href="C1.Win.TreeView.C1TreeColumn.html">C1TreeColumn</a></p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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><p>The minimum width of the given column that will fit the currently displayed content.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></td>
      <td><p>Thrown if given treecolumn is null.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></td>
      <td><p>Thrown if given treecolumn doesn't belongs to the <a class="xref" href="C1.Win.TreeView.C1TreeView.Columns.html#C1_Win_TreeView_C1TreeView_Columns">Columns</a> collection.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
