internal static IEnumerable <IDataGridItemContainer> GetTemplatedChildDataGridItemContainers(this IDataGridItemContainer source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            var predicate = IDataGridItemContainerExtensions.GetTemplatedChildExpandPredicate(source);

            return(IDataGridItemContainerExtensions.GetChildDataGridItemContainers(source, predicate));
        }
        private static IEnumerable <IDataGridItemContainer> GetChildDataGridItemContainers(IDataGridItemContainer source, Func <DependencyObject, bool> expand)
        {
            Debug.Assert(source != null);

            var root = source as DependencyObject;

            if (root == null)
            {
                throw new ArgumentException("The source object must be a DependencyObject.", "source");
            }

            return(IDataGridItemContainerExtensions.GetChildDataGridItemContainers(root, expand));
        }