Logical Tree


System.Windows.LogicalTreeHelper - only contains instances of DependencyObject sub classes
Represents the structure of your UI
Closely matches the elements you declare in the XAML
A given window/control will have one visual tree but could have any number of logical trees
The LogicalTree can contain objects of any type


GetChildren


static System.Windows.DependencyObject.SearchTreeView<T> (System.Windows.DependencyObject source) 
{
   while (source != null && source.GetType() != typeof(T) )
   {
      source = System.WIndows.Media.VisualTreeHelper.GetParent(source);
   }
   return source;
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext