public void Internal_Expand(object item)
        {
            TreeViewItemContainerData treeViewItemData = (TreeViewItemContainerData)GetItemContainerData(item);

            if (treeViewItemData == null)
            {
                throw new ArgumentException("TreeViewItemContainerData not found", "item");
            }
            if (treeViewItemData.IsExpanded)
            {
                return;
            }
            treeViewItemData.IsExpanded = true;

            if (m_expandSilently)
            {
                return;
            }

            if (ItemExpanding != null)
            {
                VirtualizingItemExpandingArgs args = new VirtualizingItemExpandingArgs(treeViewItemData.Item);
                ItemExpanding(this, args);

                IEnumerable children  = args.Children == null ? null : args.Children.OfType <object>().ToArray();
                int         itemIndex = IndexOf(treeViewItemData.Item);

                VirtualizingTreeViewItem treeViewItem = (VirtualizingTreeViewItem)GetItemContainer(treeViewItemData.Item);
                if (treeViewItem != null)
                {
                    treeViewItem.CanExpand = children != null;
                }
                else
                {
                    treeViewItemData.CanExpand = children != null;
                }

                if (treeViewItemData.CanExpand)
                {
                    foreach (object childItem in children)
                    {
                        itemIndex++;

                        TreeViewItemContainerData childData      = (TreeViewItemContainerData)Insert(itemIndex, childItem);
                        VirtualizingTreeViewItem  childContainer = (VirtualizingTreeViewItem)GetItemContainer(childItem);
                        if (childContainer != null)
                        {
                            childContainer.Parent = treeViewItemData;
                        }
                        else
                        {
                            childData.Parent = treeViewItemData;
                        }
                    }

                    UpdateSelectedItemIndex();
                }
            }
        }
        private void OnItemExpanding(object sender, VirtualizingItemExpandingArgs e)
        {
            DataItem dataItem = (DataItem)e.Item;

            if (dataItem.Children.Count <= 0)
            {
                return;
            }
            e.Children = (IEnumerable)dataItem.Children;
        }
Exemplo n.º 3
0
        private void OnItemExpanding(object sender, VirtualizingItemExpandingArgs e)
        {
            //get parent data item (game object in our case)
            DataItem dataItem = (DataItem)e.Item;

            if (dataItem.Children.Count > 0)
            {
                //Populate children collection
                e.Children = dataItem.Children;
            }
        }
        private void OnItemExpanding(object sender, VirtualizingItemExpandingArgs e)
        {
            GameObject gameObject1 = (GameObject)e.Item;

            if (gameObject1.get_transform().get_childCount() <= 0)
            {
                return;
            }
            List <GameObject> gameObjectList = new List <GameObject>();

            for (int index = 0; index < gameObject1.get_transform().get_childCount(); ++index)
            {
                GameObject gameObject2 = ((Component)gameObject1.get_transform().GetChild(index)).get_gameObject();
                gameObjectList.Add(gameObject2);
            }
            e.Children = (IEnumerable)gameObjectList;
        }
Exemplo n.º 5
0
        private void OnItemExpanding(object sender, VirtualizingItemExpandingArgs e)
        {
            //get parent data item (game object in our case)
            DataItem dataItem = (DataItem)e.Item;

            if (dataItem.Children.Count > 0)
            {
                for (int i = 0; i < 100; i++)
                {
                    DataItem item = new DataItem("Added OnItemExpanding " + i);
                    item.Parent = dataItem;
                    dataItem.Children.Add(item);
                }

                //Populate children collection
                e.Children = dataItem.Children;
            }
        }
Exemplo n.º 6
0
        private void OnItemExpanding(object sender, VirtualizingItemExpandingArgs e)
        {
            //get parent data item (game object in our case)
            GameObject gameObject = (GameObject)e.Item;

            if (gameObject.transform.childCount > 0)
            {
                //get children
                List <GameObject> children = new List <GameObject>();

                for (int i = 0; i < gameObject.transform.childCount; ++i)
                {
                    GameObject child = gameObject.transform.GetChild(i).gameObject;

                    children.Add(child);
                }

                //Populate children collection
                e.Children = children;
            }
        }
Exemplo n.º 7
0
        public void Internal_Expand(object item)
        {
            TreeViewItemContainerData itemContainerData1 = (TreeViewItemContainerData)this.GetItemContainerData(item);

            if (itemContainerData1 == null)
            {
                throw new ArgumentException("TreeViewItemContainerData not found", nameof(item));
            }
            if (itemContainerData1.IsExpanded)
            {
                return;
            }
            itemContainerData1.IsExpanded = true;
            if (this.m_expandSilently || this.ItemExpanding == null)
            {
                return;
            }
            VirtualizingItemExpandingArgs e = new VirtualizingItemExpandingArgs(itemContainerData1.Item);

            this.ItemExpanding((object)this, e);
            IEnumerable enumerable = e.Children != null ? (IEnumerable)e.Children.OfType <object>().ToArray <object>() : (IEnumerable)(object[])null;
            int         index1     = this.IndexOf(itemContainerData1.Item);
            VirtualizingTreeViewItem itemContainer1 = (VirtualizingTreeViewItem)this.GetItemContainer(itemContainerData1.Item);

            if (Object.op_Inequality((Object)itemContainer1, (Object)null))
            {
                itemContainer1.CanExpand = enumerable != null;
            }
            else
            {
                itemContainerData1.CanExpand = enumerable != null;
            }
            if (!itemContainerData1.CanExpand)
            {
                return;
            }
            foreach (object obj in enumerable)
            {
                ++index1;
                TreeViewItemContainerData itemContainerData2 = (TreeViewItemContainerData)this.Insert(index1, obj);
                VirtualizingTreeViewItem  itemContainer2     = (VirtualizingTreeViewItem)this.GetItemContainer(obj);
                if (Object.op_Inequality((Object)itemContainer2, (Object)null))
                {
                    itemContainer2.Parent = itemContainerData1;
                }
                else
                {
                    itemContainerData2.Parent = itemContainerData1;
                }
            }
            if (e.ChildrenExpand != null)
            {
                object[] array1 = e.Children.OfType <object>().ToArray <object>();
                bool[]   array2 = e.ChildrenExpand.OfType <bool>().ToArray <bool>();
                for (int index2 = 0; index2 < array1.Length; ++index2)
                {
                    if (array2[index2])
                    {
                        this.Expand(array1[index2]);
                    }
                }
            }
            this.UpdateSelectedItemIndex();
        }