Exemple #1
0
 /// <summary>
 ///     <para>
 ///       Adds the contents of another <see cref='Telerik.WinControls.RadElementCollection'/> to the end of the collection.
 ///    </para>
 /// </summary>
 /// <param name='value'>
 ///    A <see cref='Telerik.WinControls.RadElementCollection'/> containing the objects to add to the collection.
 /// </param>
 /// <returns>
 ///   <para>None.</para>
 /// </returns>
 public void AddRange(RadElementCollection value)
 {
     this.Capacity = this.Count + value.Count;
     for (int i = 0; (i < value.Count); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
Exemple #2
0
 public void AddRange(RadElementCollection value)
 {
     this.Capacity  = this.Count + value.Count;
     this.suspended = true;
     for (int index = 0; index < value.Count; ++index)
     {
         this.Add(value[index]);
     }
     this.suspended = false;
     this.owner.ChangeCollection((RadElement)null, ItemsChangeOperation.BatchInsert);
 }
Exemple #3
0
 public RadElementEnumerator(RadElementCollection mappings)
 {
     this.temp           = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
Exemple #4
0
 /// <summary>
 ///     <para>
 ///       Initializes a new instance of the <see cref='Telerik.WinControls.RadElementCollection'/> based on another <see cref='Telerik.WinControls.RadElementCollection'/>.
 ///    </para>
 /// </summary>
 /// <param name="owner"></param>
 /// <param name='value'>
 ///       A <see cref='Telerik.WinControls.RadElementCollection'/> from which the contents are copied
 /// </param>
 public RadElementCollection(RadElement owner, RadElementCollection value)
     : base(1)
 {
     this.owner = owner;
     this.AddRange(value);
 }
Exemple #5
0
        /*private void PrepareCache(RadElement rootElement)
         * {
         *      this.AddElementToCache(rootElement);
         *
         *      RadElementReadonlyList children = rootElement.ChildrenHierarchy;
         *      for (int i = 0; i < children.Count; i++)
         *      {
         *              AddElementToCache(children[i]);
         *      }
         * }*/

        private void PrepareCache(RadElement rootElement)
        {
            this.AddElementToCache(rootElement);

            ISelectorCacheHelper helper = rootElement as ISelectorCacheHelper;

            if (helper != null)
            {
                helper.RegisterElementsInCache(cachedChildrenHierarchyByElement);
                return;
            }

            RadElementCollection children = rootElement.Children;
            int  depth              = 1;
            int  currIndex          = 0;
            bool traversingChildren = true;

            do
            {
                if (currIndex >= children.Count)
                {
                    depth -= 1;
                    RadElement parent = children.Owner.Parent;
                    if (parent != null)
                    {
                        currIndex          = parent.Children.IndexOf(children.Owner);
                        children           = parent.Children;
                        traversingChildren = false;
                    }
                }
                else
                {
                    RadElement child      = children[currIndex];
                    StyleSheet childStyle = child.Style;

                    if (traversingChildren)
                    {
                        if (child.PropagateStyleToChildren &&
                            (childStyle == null || !child.ElementThemeAffectsChildren) &&
                            child.Children.Count > 0)
                        {
                            helper = child as ISelectorCacheHelper;
                            if (helper != null)
                            {
                                helper.RegisterElementsInCache(cachedChildrenHierarchyByElement);
                            }
                            else
                            {
                                children  = child.Children;
                                currIndex = 0;
                                depth++;
                                continue;
                            }
                        }
                    }

                    if (childStyle == null /*&& child.PropagateStyleToChildren*/)
                    {
                        AddElementToCache(child);
                    }
                    currIndex++;
                    traversingChildren = true;
                }
            }while (depth > 0);
        }