Exemplo n.º 1
0
        /// <summary>
        /// Returns a collection of child elements.
        /// </summary>
        public static IEnumerable <Control> Elements(this Control item)
        {
            ILinqTree <Control> adapter = new WindowsFormsTreeAdapter(item);

            foreach (var child in adapter.Children())
            {
                yield return(child);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a collection of ancestor elements.
        /// </summary>
        public static IEnumerable <Control> Ancestors(this Control item)
        {
            ILinqTree <Control> adapter = new WindowsFormsTreeAdapter(item);

            var parent = adapter.Parent;

            while (parent != null)
            {
                yield return(parent);

                adapter = new WindowsFormsTreeAdapter(parent);
                parent  = adapter.Parent;
            }
        }