Esempio n. 1
0
 /// <summary>
 /// Layout the children of the current layout
 /// </summary>
 /// <param name="x">X delay</param>
 /// <param name="y">Y delay</param>
 /// <param name="width">Width constraint to layout</param>
 /// <param name="height">Height constraint to layout</param>
 protected override void LayoutChildren(double x, double y, double width, double height)
 {
     foreach (var item in VirtualizingItemsControl.GetDisplayedChildren())
     {
         item.View.Layout(new Rectangle(x, y + rowHeight * item.Index, width, rowHeight));
     }
 }
Esempio n. 2
0
        internal void SetVirtualizingItemsControl(VirtualizingItemsControl virtualizingItemsControl)
        {
            if (this.ScrollOwner != null)
            {
                this.ScrollOwner.SizeChanged -= this.ScrollOwner_SizeChanged;
                this.ScrollOwner.Scrolled    -= this.ScrollOwner_Scrolled;
            }

            this.VirtualizingItemsControl = virtualizingItemsControl;
            this.InitializeScrollOwner();
        }
Esempio n. 3
0
        /// <summary>
        /// Method called when a measurement is asked.
        /// </summary>
        /// <param name="widthConstraint">Width constraint</param>
        /// <param name="heightConstraint">Height constraint</param>
        /// <returns>Requested size</returns>
        protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
        {
            this.InitializeScrollOwner();
            var firstItem = VirtualizingItemsControl?.GenerateAt(0);

            if (firstItem == null)
            {
                return(base.OnMeasure(widthConstraint, heightConstraint));
            }

            var request      = firstItem.Measure(widthConstraint, double.PositiveInfinity, MeasureFlags.IncludeMargins);
            var oldRowHeight = rowHeight;

            this.rowHeight = request.Request.Height;
            var height = this.VirtualizingItemsControl.ItemsSource.Count * request.Request.Height;

            if (oldRowHeight != rowHeight)
            {
                GenerateItemsForViewport();
            }

            return(new SizeRequest(new Size(request.Request.Width, height)));
        }