private static void GetChildTree(this FrameworkElement root, string prefix, string addPrefix, List <string> results)
        {
            string str = (!string.IsNullOrEmpty(root.Name) ? root.Name : "[Anon]") + " " + root.GetType().Name;

            results.Add(prefix + str);
            foreach (FrameworkElement root1 in ExtensionMethods.GetVisualChildren(root))
            {
                ExtensionMethods.GetChildTree(root1, prefix + addPrefix, addPrefix, results);
            }
        }
        public static void PrintDescendentsTree(this FrameworkElement root)
        {
            List <string> results = new List <string>();

            ExtensionMethods.GetChildTree(root, "", "  ", results);
            foreach (string message in results)
            {
                Debug.WriteLine(message);
            }
        }