예제 #1
0
        /// <summary>
        /// Finds all child controls of specified type.
        /// </summary>
        /// <typeparam name="T">Type of the children required.</typeparam>
        /// <param name="container">Dependency object whose children are found.</param>
        /// <returns>The ControlSet object containing the children found.</returns>
        public static ControlSet ByType <T>(DependencyObject container)
        {
            ChildrenFinder childrenFinder = new ChildrenFinder();

            childrenFinder.FindByType <T>(container);
            return(childrenFinder.Children);
        }
예제 #2
0
        /// <summary>
        /// Finds all child controls of a given control. The given control need not to be a container control like Panel or Grid. It can be of primitive types also (like ContentControl, Selector), because the rendered Silverlight output can contain any control within any other control (through the use of data-templates and control-templates). For example, there can be a Grid control inside the control-template of a ContentControl.
        /// </summary>
        /// <param name="container">Dependency object whose children are found.</param>
        /// <returns>The ControlSet object containing all the children of the given control.</returns>
        public static ControlSet All(DependencyObject container)
        {
            ChildrenFinder childrenFinder = new ChildrenFinder();

            childrenFinder.All(container);
            return(childrenFinder.Children);
        }