예제 #1
0
 /// <summary>
 /// Gets the children.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 /// <value>The children.</value>
 public IEnumerable<IElement> GetChildren(ElementEnumeratorSettings settings)
 {
     foreach(var item in _enumerable)
     {
         var element = settings.GetBoundProperty(item, Type, Name);
         if(element != null) yield return element;
     }
 }
예제 #2
0
 /// <summary>
 /// Gets the children.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 /// <value>The children.</value>
 public IEnumerable <IElement> GetChildren(ElementEnumeratorSettings settings)
 {
     foreach (var item in enumerable)
     {
         var element = settings.GetBoundProperty(item, Type, Name);
         if (element != null)
         {
             yield return(element);
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Gets the children.
        /// </summary>
        /// <value>The children.</value>
        public IEnumerable<IElement> GetChildren(ElementEnumeratorSettings settings)
        {
            foreach(var setterBase in _style.Setters)
            {
                var setter = setterBase as Setter;

                if(setter == null) continue;
                if(setter.Value is BindingBase) continue;

                var dataBound = settings.GetBoundProperty(setter.Value, Type, Name);

                if(dataBound != null)
                    yield return dataBound;
            }
        }
예제 #4
0
        /// <summary>
        /// Gets the children.
        /// </summary>
        /// <value>The children.</value>
        public IEnumerable <IElement> GetChildren(ElementEnumeratorSettings settings)
        {
            foreach (var setterBase in style.Setters)
            {
                var setter = setterBase as Setter;

                if (setter == null)
                {
                    continue;
                }
                if (setter.Value is BindingBase)
                {
                    continue;
                }

                var dataBound = settings.GetBoundProperty(setter.Value, Type, Name);

                if (dataBound != null)
                {
                    yield return(dataBound);
                }
            }
        }
        /// <summary>
        /// Gets the children.
        /// </summary>
        /// <value>The children.</value>
        public IEnumerable<IElement> GetChildren(ElementEnumeratorSettings settings)
        {
            if(Type == null) yield break;

            var checkedProperties = new List<string>();

            foreach(var item in CheckContentControl(checkedProperties, settings))
            {
                yield return item;
            }

            foreach(var item in CheckItemsControl(checkedProperties, settings))
            {
                yield return item;
            }

            var logicalChildren = LogicalTreeHelper.GetChildren(Element).Cast<object>().ToList();
            var enumerator = _element.GetLocalValueEnumerator();

            while(enumerator.MoveNext())
            {
                var entry = enumerator.Current;

                if(BindingOperations.IsDataBound(_element, entry.Property)) continue;
                if(checkedProperties.Contains(entry.Property.Name)) continue;
                if(logicalChildren.Contains(entry.Value)) continue;

                var dataBound = settings.GetBoundProperty(entry.Value, Type, Name);

                if(dataBound != null)
                    yield return dataBound;
            }

            if(!CheckLogicalChildren) yield break;

            foreach(var child in logicalChildren)
            {
                if(child is DependencyObject)
                {
                    yield return Bound.DependencyObject(
                        child as DependencyObject,
                        Type, Name + ".",
                        (settings.TraverseUserControls || !(child is UserControl))
                        );
                }
            }
        }
        /// <summary>
        /// Gets the children.
        /// </summary>
        /// <value>The children.</value>
        public IEnumerable <IElement> GetChildren(ElementEnumeratorSettings settings)
        {
            if (Type == null)
            {
                yield break;
            }

            var checkedProperties = new List <string>();

            foreach (var item in CheckContentControl(checkedProperties, settings))
            {
                yield return(item);
            }

            foreach (var item in CheckItemsControl(checkedProperties, settings))
            {
                yield return(item);
            }

            var logicalChildren = LogicalTreeHelper.GetChildren(Element).Cast <object>().ToList();
            var enumerator      = element.GetLocalValueEnumerator();

            while (enumerator.MoveNext())
            {
                var entry = enumerator.Current;

                if (BindingOperations.IsDataBound(element, entry.Property))
                {
                    continue;
                }
                if (checkedProperties.Contains(entry.Property.Name))
                {
                    continue;
                }
                if (logicalChildren.Contains(entry.Value))
                {
                    continue;
                }

                var dataBound = settings.GetBoundProperty(entry.Value, Type, Name);

                if (dataBound != null)
                {
                    yield return(dataBound);
                }
            }

            if (!CheckLogicalChildren)
            {
                yield break;
            }

            foreach (var child in logicalChildren)
            {
                if (child is DependencyObject)
                {
                    yield return(Bound.DependencyObject(
                                     child as DependencyObject,
                                     Type, Name + ".",
                                     (settings.TraverseUserControls || !(child is UserControl))
                                     ));
                }
            }
        }