Пример #1
0
        public static FrameworkElement FindElementInVisualTree(Visual root, string id)
        {
            FrameworkElement frameworkElement = root as FrameworkElement;

            if (frameworkElement != null && frameworkElement.Name == id)
            {
                return(frameworkElement);
            }
            for (int childIndex = 0; childIndex < VisualTreeHelper.GetChildrenCount((DependencyObject)root); ++childIndex)
            {
                Visual root1 = VisualTreeHelper.GetChild((DependencyObject)root, childIndex) as Visual;
                if (root1 != null)
                {
                    FrameworkElement elementInVisualTree = ElementUtilities.FindElementInVisualTree(root1, id);
                    if (elementInVisualTree != null)
                    {
                        return(elementInVisualTree);
                    }
                }
            }
            return((FrameworkElement)null);
        }
Пример #2
0
 public static bool HasVisualTreeAncestorOfType(DependencyObject element, Type type)
 {
     return(ElementUtilities.GetVisualTreeAncestorOfType(element, type) != null);
 }
Пример #3
0
 public static Rect GetActualBoundsInParent(FrameworkElement element)
 {
     return(ElementUtilities.GetActualBoundsCore(element, true));
 }
Пример #4
0
 public static Vector GetCorrespondingVector(Vector vector, Matrix matrix)
 {
     return(ElementUtilities.GetCorrespondingVector(vector, matrix, (AxisConstraint)null));
 }
Пример #5
0
 public static Rect GetActualBounds(FrameworkElement element)
 {
     return(ElementUtilities.GetActualBoundsCore(element, false));
 }