示例#1
0
        void EnsureItems()
        {
            if (this.items == null)
            {
                TreeGrid    grid     = this.OwnerGrid;
                IEnumerable rawItems = null;

                if (this.Parent != null)
                {
                    rawItems = grid.ChildrenFunc(this.Parent.items[this.childIndex]);
                }

                if (rawItems == null)
                {
                    rawItems = emptyItems;
                }

                this.items = rawItems as IList;
                if (this.items == null)
                {
                    // If we don't get an indexable collection as our items, then we must create one.
                    this.items = rawItems.OfType <object>().ToArray();
                }

                ObserveItems();
                this.flatCount = this.items.Count;
            }
        }