Beispiel #1
0
        protected virtual void UpdateItemCount()
        {
            var collection = TypedDrawingValue;

            itemCountGetResult = typeof(TCollection).IsValueType || collection != null
                ? itemCountGetter.GetValue(out itemCount) : (ValueAccessResult?)null;
        }
Beispiel #2
0
        public void ChildrenUpdate(TList list)
        {
            int countInPage = This.ItemCountInCurrentPage;

            // Remove redundant child drawers.
            while (This.ChildCount > countInPage)
            {
                This.LastChild.Parent = null;
            }

            int firstItemIndex = This.FirstItemIndexOfCurrentPage;

            for (int i = 0; i < countInPage; ++i)
            {
                int  itemIndex = firstItemIndex + i;
                Type itemType;
                ItemTypeGetter.GetValue(list, itemIndex, out itemType, DefaultItemType);
                var childType = ValueDrawerTypes.GetOrBuild(typeof(TList), itemType);

                var child = This.GetChild(i) as ValueDrawer;
                if (child != null)
                {
                    if (child.GetType() != childType)
                    {
                        child = (ValueDrawer)Drawer.Create(childType);
                        This.ReplaceChild(i, child);
                    }
                }
                else
                {
                    child = (ValueDrawer)Drawer.Create(childType);
                    child.ChangeParent(This, i);
                }
                child.Name       = itemIndex.ToString();
                child.ValueEntry = ChildValueEntryCreator(list, itemType, itemIndex);
            }
        }