示例#1
0
        public static List <T> FindControls <T>(Control seed, string typeFullName, bool shallow) where T : Control
        {
            if (seed == null || string.IsNullOrEmpty(typeFullName))
            {
                return(null);
            }

            seed = (seed is INamingContainer) ? seed : seed.NamingContainer;
            List <T> foundControls = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf(control, typeFullName, shallow))
                {
                    foundControls.Add(control as T);
                }

                if (ControlUtils.HasControls(control))
                {
                    foundControls.AddRange(ControlUtils.FindChildControls <T>(control, typeFullName, shallow));
                }
            }

            return(foundControls);
        }
示例#2
0
        public static List <T> FindChildControls <T>(Control seed, string typeFullName, bool shallow) where T : Control
        {
            if (seed == null || string.IsNullOrEmpty(typeFullName))
            {
                return((List <T>)null);
            }
            List <T> objList = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf((object)control, typeFullName, shallow))
                {
                    objList.Add(control as T);
                }
                if (ControlUtils.HasControls(control))
                {
                    objList.AddRange((IEnumerable <T>)ControlUtils.FindChildControls <T>(control, typeFullName, shallow));
                }
            }
            return(objList);
        }
示例#3
0
        public static List <T> FindControls <T>(Control seed, bool shallow) where T : Control
        {
            if (seed == null)
            {
                return((List <T>)null);
            }
            seed = seed is INamingContainer ? seed : seed.NamingContainer;
            List <T> objList = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf((object)control, typeof(T), shallow))
                {
                    objList.Add(control as T);
                }
                if (ControlUtils.HasControls(control))
                {
                    objList.AddRange((IEnumerable <T>)ControlUtils.FindChildControls <T>(control, shallow));
                }
            }
            return(objList);
        }
示例#4
0
        public static List <T> FindChildControls <T>(Control seed, bool shallow) where T : Control
        {
            if (seed == null)
            {
                return(null);
            }

            List <T> foundControls = new List <T>();

            foreach (Control control in seed.Controls)
            {
                if (ReflectionUtils.IsTypeOf(control, typeof(T), shallow))
                {
                    foundControls.Add(control as T);
                }

                if (ControlUtils.HasControls(control))
                {
                    foundControls.AddRange(ControlUtils.FindChildControls <T>(control, shallow));
                }
            }

            return(foundControls);
        }
示例#5
0
 public static List <T> FindChildControls <T>(Control seed) where T : Control
 {
     return(ControlUtils.FindChildControls <T>(seed, false));
 }