# C1.WPF.VTreeHelper.GetFirstParent

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_VTreeHelper_GetFirstParent_" data-uid="C1.WPF.VTreeHelper.GetFirstParent*">GetFirstParent Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_VTreeHelper_GetFirstParent_" data-uid="C1.WPF.VTreeHelper.GetFirstParent*"></a>
<h4 id="C1_WPF_VTreeHelper_GetFirstParent_System_Windows_DependencyObject_System_Collections_Generic_IList_System_Type__System_Windows_DependencyObject_" data-uid="C1.WPF.VTreeHelper.GetFirstParent(System.Windows.DependencyObject,System.Collections.Generic.IList{System.Type},System.Windows.DependencyObject)">GetFirstParent(DependencyObject, IList&lt;Type&gt;, DependencyObject)</h4>
<div class="markdown level1 summary"><p>Returns a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.dependencyobject">DependencyObject</a> value that represents the first parent
of the visual object which type is one of the specified tyles. Method looks up the visual tree until
the desired parent element is found or parent element is equal to the specified endObject.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static DependencyObject GetFirstParent(DependencyObject reference, IList&lt;Type&gt; types, DependencyObject endObject)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function GetFirstParent(reference As DependencyObject, types As IList(Of Type), endObject As DependencyObject) As DependencyObject</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.windows.dependencyobject">DependencyObject</a></td>
      <td><span class="parametername">reference</span></td>
      <td><p>The visual whose parent is returned.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a>&gt;</td>
      <td><span class="parametername">types</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList&lt;T&gt;</a> list of types to search for.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.dependencyobject">DependencyObject</a></td>
      <td><span class="parametername">endObject</span></td>
      <td><p>The visual representing the end point of search.</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.windows.dependencyobject">DependencyObject</a></td>
      <td><p>The parent of the visual.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
