title: Find logical child including hidden and collapsed nodes
body: <p>I have tried finding an answer to this problem and in every post I find there is an answer to finding children recursively but none of them work with hidden or collapsed children</p>
  
  <p>Also in every post someone has asked if this is possible but no one has answered so I am beginning to think this isn't possible</p>
  
  <p>If anyone has a way of doing this I will be eternally grateful.</p>
  
  <p>My function looks like this:</p>
  
  <pre><code>        public static DependencyObject FindLogicalDescendentByName(this DependencyObject source, string name)
      {
          DependencyObject result = null;
          IEnumerable children = LogicalTreeHelper.GetChildren(source);
  
          foreach (var child in children)
          {
              if (child is DependencyObject)
              {
                  if (child is FrameworkElement)
                  {
                      if ((child as FrameworkElement).Name.Equals(name))
                          result = (DependencyObject)child;
                      else
                          result = (child as DependencyObject).FindLogicalDescendentByName(name);
                  }
                  else
                  {
                      result = (child as DependencyObject).FindLogicalDescendentByName(name);
                  }
                  if (result != null)
                      return result;
              }
          }
          return result;
      }
  </code></pre>
  
  <p>-EDITED 
  So, 
  I realise my problem is that I was trying to find the item before it was created, </p>
  
  <p>I was binding to a property in xaml that would go off and find an item by a given name, but the item wasnt created at that point in time, if I re-ordered the item in xaml, it works and the item is found... doh!</p>