private static void GetAncestorVisualTree(this FrameworkElement node, List <string> children)
        {
            string str = (string.IsNullOrEmpty(node.Name) ? "[Anon]" : node.Name) + ": " + node.GetType().Name;

            children.Insert(0, str);
            FrameworkElement visualParent = ExtensionMethods.GetVisualParent(node);

            if (visualParent == null)
            {
                return;
            }
            ExtensionMethods.GetAncestorVisualTree(visualParent, children);
        }
        public static void PrintAncestorTree(this FrameworkElement node)
        {
            List <string> children = new List <string>();

            ExtensionMethods.GetAncestorVisualTree(node, children);
            string str1 = "";

            foreach (string str2 in children)
            {
                Debug.WriteLine(str1 + str2);
                str1 = str1 + "  ";
            }
        }