Ejemplo n.º 1
0
        internal double AddOneChild(RealizedItemsInfo info)
        {
            var child = _generator.ContainerFromIndex(_info.Next);

            if (child == null)
            {
                var materialized = _generator.Materialize(_info.Next, _items.ElementAt(_info.Next));
                child = materialized.ContainerControl;
                _panel.Children.Add(child);
                child.Measure(Size.Infinity);
                PdmLogger.Log(2, PdmLogger.IndentEnum.Nothing, $"Add new Item {child.DataContext} to {this} {_info._currentOffset:0.00}");
                if (VirtualizingAverages.AddContainerSize(_groupControl.TemplatedParent, _items.ElementAt(_info.Next), child))
                {
                    _owner.InvalidateMeasure();
                }
            }
            else
            {
                if (child is GroupItem gi)
                {
                    gi.Presenter?.InvalidateMeasure();
                }
                if (_id == 402)
                {
                }
                child.Measure(Size.Infinity);
                PdmLogger.Log(2, PdmLogger.IndentEnum.Nothing, $"Add old Item {child.DataContext} to {this} {_info._currentOffset:0.00}");
                if (VirtualizingAverages.AddContainerSize(_groupControl.TemplatedParent, _items.ElementAt(_info.Next), child))
                {
                    _owner.InvalidateMeasure();
                }
            }
            return(_info.Vert ? child.DesiredSize.Height : child.DesiredSize.Width);
        }
Ejemplo n.º 2
0
        internal void AddGroup(RealizedItemsInfo info, IItemContainerGenerator generator, int scrollPos)
        {
            var previousNumInfullView = NumInFullView;

            RemoveOld();
            foreach (var item in generator.Containers)
            {
                var res     = item.ContainerControl.TranslatePoint(new Point(0, 0), _panel);
                var itemPos = (item.Item is IGroupingView gv) ? gv.ItemScrollStart : item.Index + info.ScrollOffset;
                if (!RealizedIndex.TryGetValue(itemPos, out var realizedInfo))
                {
                    realizedInfo = new RealizedItemInfo();
                    RealizedIndex.Add(itemPos, realizedInfo);
                }
                realizedInfo.Set(item);
                realizedInfo.RelativeOffset = res.Value.Y;
            }
            NumInFullView = GetNumInView(scrollPos);
            if (NumInFullView == 8)
            {
            }
            if (previousNumInfullView != NumInFullView)
            {
                _scrollContentPresenter.InvalidateArrange();
            }
        }
Ejemplo n.º 3
0
 public RealizedItems(ItemsPresenter owner, GroupController groupControl, int id)
 {
     _owner        = owner;
     _panel        = owner.Panel;
     _items        = owner.Items;
     _generator    = owner.ItemContainerGenerator;
     _scrollViewer = owner.FindAncestorOfType <ScrollViewer>();
     _id           = id;
     _cache        = owner.VirtualizingCache;
     _groupControl = groupControl;
     if (owner.VirtualizationMode == ItemVirtualizationMode.Logical)
     {
         _info = new RealizedItemsInfo2(_items, groupControl.Vertical, _cache, groupControl.TemplatedParent);
     }
     else
     {
         _info = new RealizedItemsInfo(_items, groupControl.Vertical, _cache, groupControl.TemplatedParent);
     }
 }