示例#1
0
        private static Func <DependencyObject, bool> GetTemplatedDescendantExpandPredicate(IDataGridItemContainer source)
        {
            var fe = source as FrameworkElement;

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

            return(( DependencyObject item ) => IDataGridItemContainerExtensions.IsPartOfTargetTemplate(item, fe));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
        private static bool IsPartOfTargetTemplate(DependencyObject element, FrameworkElement target)
        {
            while (element != null)
            {
                var templatedParent = IDataGridItemContainerExtensions.GetTemplatedParent(element);
                if (templatedParent == target)
                {
                    return(true);
                }

                element = templatedParent;
            }

            return(false);
        }