private UserControl WalkControls(Control parent, Type targetType)
        {               //****************************************
            UserControl ChildControl;

            //****************************************

            foreach (Control MyControl in parent.Controls)
            {
                if (MyControl.GetType() == targetType)
                {
                    return((UserControl)MyControl);
                }

                if (MyControl.Controls.Count == 0)
                {
                    continue;
                }

                ChildControl = WalkControls(MyControl, targetType);

                if (ChildControl != null)
                {
                    return(ChildControl);
                }
            }

            return(null);
        }
        //****************************************

        private UserControl WalkControls(FrameworkElement parent, Type targetType)
        {               //****************************************
            UserControl ChildControl;

            //****************************************

            if (parent is ContentControl)
            {
                return(WalkControls(((ContentControl)parent).Content as FrameworkElement, targetType));
            }

            if (parent is Panel)
            {
                foreach (FrameworkElement MyControl in ((Panel)parent).Children)
                {
                    if (MyControl.GetType() == targetType)
                    {
                        return((UserControl)MyControl);
                    }

                    ChildControl = WalkControls(MyControl, targetType);

                    if (ChildControl != null)
                    {
                        return(ChildControl);
                    }
                }
            }

            if (parent is ItemsControl)
            {
                foreach (FrameworkElement MyControl in ((ItemsControl)parent).Items)
                {
                    if (MyControl.GetType() == targetType)
                    {
                        return((UserControl)MyControl);
                    }

                    ChildControl = WalkControls(MyControl, targetType);

                    if (ChildControl != null)
                    {
                        return(ChildControl);
                    }
                }
            }

            return(null);
        }