Beispiel #1
0
        public void FinishExpansion()
        {
            TreeViewItem      item     = pendingItem;
            ItemExpandingArgs args     = new ItemExpandingArgs(item.Item);
            IEnumerable       children = args.Children;
            int containerIndex         = item.transform.GetSiblingIndex();
            int itemIndex = IndexOf(item.Item);

            item.CanExpand = children != null;

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

                    TreeViewItem childContainer = (TreeViewItem)InstantiateItemContainer(containerIndex);
                    childContainer.Parent = item;
                    childContainer.Item   = childItem;

                    InsertItem(itemIndex, childItem);
                    DataBindItem(childItem, childContainer);
                }

                UpdateSelectedItemIndex();
            }
        }
Beispiel #2
0
        public void Expand(TreeViewItem item)
        {
            if (this.m_expandSilently || this.ItemExpanding == null)
            {
                return;
            }
            ItemExpandingArgs e = new ItemExpandingArgs(item.Item);

            this.ItemExpanding((object)this, e);
            IEnumerable children     = e.Children;
            int         siblingIndex = ((Component)item).get_transform().GetSiblingIndex();
            int         index        = this.IndexOf(item.Item);

            item.CanExpand = children != null;
            if (!item.CanExpand)
            {
                return;
            }
            foreach (object obj in children)
            {
                ++siblingIndex;
                ++index;
                this.InsertItem(index, obj);
                TreeViewItem treeViewItem = (TreeViewItem)this.InstantiateItemContainer(siblingIndex);
                treeViewItem.Item   = obj;
                treeViewItem.Parent = item;
                this.DataBindItem(obj, (ItemContainer)treeViewItem);
            }
            this.UpdateSelectedItemIndex();
        }
        private void OnItemExpanding(object sender, ItemExpandingArgs e)
        {
            GameObject gameObject = (GameObject)e.Item;

            if (gameObject.transform.childCount > 0)
            {
                GameObject[] children = new GameObject[gameObject.transform.childCount];
                for (int i = 0; i < children.Length; ++i)
                {
                    children[i] = gameObject.transform.GetChild(i).gameObject;
                }
                e.Children = children;
            }
        }
        public void Expand(object item)
        {
            if (m_expandSilently)
            {
                return;
            }

            if (ItemExpanding != null)
            {
                TreeViewItemContainerData treeViewItemData = (TreeViewItemContainerData)GetItemContainerData(item);

                ItemExpandingArgs args = new ItemExpandingArgs(treeViewItemData.Item);
                ItemExpanding(this, args);

                IEnumerable children  = 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, ItemExpandingArgs e)
        {
            GameObject gameObject = (GameObject)e.Item;

            if (gameObject.get_transform().get_childCount() <= 0)
            {
                return;
            }
            GameObject[] gameObjectArray = new GameObject[gameObject.get_transform().get_childCount()];
            for (int index = 0; index < gameObjectArray.Length; ++index)
            {
                gameObjectArray[index] = ((Component)gameObject.get_transform().GetChild(index)).get_gameObject();
            }
            e.Children = (IEnumerable)gameObjectArray;
        }
        private void OnItemExpanding(object sender, ItemExpandingArgs e)
        {
            //get parent data item (game object in our case)
            GameObject gameObject = (GameObject)e.Item;

            if (gameObject.transform.childCount > 0)
            {
                //get children
                GameObject[] children = new GameObject[gameObject.transform.childCount];
                for (int i = 0; i < children.Length; ++i)
                {
                    children[i] = gameObject.transform.GetChild(i).gameObject;
                }

                //Populate children collection
                e.Children = children;
            }
        }
Beispiel #7
0
        private void OnItemExpanding(object sender, ItemExpandingArgs e)
        {
            //get parent data item (game object in our case)
            TreeData td   = ((GameObject)e.Item).GetComponent <TreeData>();
            int      size = td.nodes.Count;

            if (size > 0)
            {
                //get children
                GameObject[] children = new GameObject[size];
                for (int i = 0; i < td.nodes.Count; ++i)
                {
                    children[i] = td.nodes[i];
                }

                //Populate children collection
                e.Children = children;
            }
        }
        private void OnItemExpanding(object sender, ItemExpandingArgs 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;
            }
        }
Beispiel #9
0
        /// <summary>
        /// Expand Tree View Item
        /// </summary>
        /// <param name="item">tree view item to expand</param>
        public void Expand(TreeViewItem item)
        {
            if (m_expandSilently)
            {
                return;
            }

            pendingItem = item;

            if (ItemExpanding != null)
            {
                ItemExpandingArgs args = new ItemExpandingArgs(item.Item);
                ItemExpanding(this, args);

                IEnumerable children       = args.Children;
                int         containerIndex = item.transform.GetSiblingIndex();
                int         itemIndex      = IndexOf(item.Item);

                item.CanExpand = children != null;

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

                        TreeViewItem childContainer = (TreeViewItem)InstantiateItemContainer(containerIndex);
                        childContainer.Parent = item;
                        childContainer.Item   = childItem;

                        InsertItem(itemIndex, childItem);
                        DataBindItem(childItem, childContainer);
                    }

                    UpdateSelectedItemIndex();
                }
            }
        }