Exemple #1
0
        public void CopyTo(View [] array, int arrayIndex)
        {
            _views.CopyTo(array, arrayIndex);
            _layout.Invalidate();

            ChildrenAdded?.Invoke(this, new LayoutEventArgs(arrayIndex, array.Length));
        }
Exemple #2
0
        public void Insert(int index, View item)
        {
            if (item == null)
            {
                return;
            }

            _views.Insert(index, item);
            item.Parent     = this;
            item.Navigation = Parent as NavigationView ?? Parent?.Navigation;
            ChildrenAdded?.Invoke(this, new LayoutEventArgs(index, 1));
        }
Exemple #3
0
        public void AddChildren(IEnumerable <ITreeItem> children)
        {
            List <ITreeItem> added = new List <ITreeItem>();

            foreach (ITreeItem child in children)
            {
                if (Add(child, false))
                {
                    added.Add(child);
                }
            }
            if (added.Count > 0)
            {
                TreeItemChildrenAddEventArgs args =
                    new TreeItemChildrenAddEventArgs(added);
                ChildrenAdded?.Invoke(this, args);
            }
        }
Exemple #4
0
 private bool Add(ITreeItem item, bool sendEvent)
 {
     if (!children.Contains(item))
     {
         children.Add(item);
         item.Parent = this;
         if (sendEvent)
         {
             TreeItemChildrenAddEventArgs args =
                 new TreeItemChildrenAddEventArgs(new List <ITreeItem>()
             {
                 item
             });
             ChildrenAdded?.Invoke(this, args);
         }
         return(true);
     }
     return(false);
 }