示例#1
0
        private void ScheduleReArrangeIfNeeded(UIElement child)
        {
            bool isScheduled;

            if (this.isChildRearrangeScheduled.TryGetValue(child, out isScheduled) && isScheduled)
            {
                return;
            }

            this.isChildRearrangeScheduled[child] = true;

            this.Dispatcher.BeginInvoke(
                delegate
            {
                try
                {
                    if (child.measuredFor != null)
                    {
                        var measuredSize = child.MeasureOverride(child.measuredFor.Value);
                        if (child.arrangedSize == measuredSize)
                        {
                            child.Arrange(new RectangleF(child.TranslatePoint, child.arrangedSize));
                            return;
                        }
                    }

                    this.needsResizeChilds.Add(child);
                    this.InvalidateMeasure();
                }
                finally
                {
                    this.isChildRearrangeScheduled[child] = false;
                }
            });
        }
            public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
            {
                UIElement container  = null;
                var       nativeView = cell.ContentView.Subviews.FirstOrDefault();

                if (nativeView != null)
                {
                    if (this.nativeViewContainers.TryGetValue(nativeView, out container) == false)
                    {
                        nativeView.RemoveFromSuperview();
                    }
                }

                if (container == null)
                {
                    container = (UIElement)this.panel.Generator.ContainerFromIndex(indexPath.Row);
                    this.panel.AddLogicalChild(container);
                    this.nativeViewContainers.Add(container.NativeUIElement, container);
                    cell.ContentView.AddSubview(container.NativeUIElement);
                }
                else
                {
                    this.panel.Generator.Reuse(indexPath.Row, container);
                }

                container.MeasureOverride(this.GetItemAvailableSize(this.panel.measuredSize));
                container.Arrange(new CGRect(CGPoint.Empty, container.measuredSize));
                container.LayoutUpdated += this.panel.Child_LayoutUpdated;
            }
        public void ArrangeItemAtPosition(UIElement child, int index)
        {
            child.MeasureOverride(this.arrangedSize);
            var rect = new RectangleF(new PointF(index * this.arrangedSize.Width, 0), this.arrangedSize);

            child.Arrange(rect);
        }
示例#4
0
        private void ScheduleReArrangeIfNeeded(UIElement child)
        {
            bool isScheduled;

            if (this.isChildRearrangeScheduled.TryGetValue(child, out isScheduled) && isScheduled)
            {
                return;
            }

            this.isChildRearrangeScheduled[child] = true;

            this.Dispatcher.BeginInvoke(
                delegate
            {
                try
                {
                    var size = child.MeasureOverride(child.measuredFor.Value);
                    child.Arrange(new RectangleF(child.TranslatePoint, size));
                }
                finally
                {
                    this.isChildRearrangeScheduled[child] = false;
                }
            });
        }
示例#5
0
        private void ArrangeChild(UIElement child)
        {
            if (child.NativeUIElement != null)
            {
                SizeF needSize = new SizeF();
                if (this.childSizeCache.ContainsKey(child))
                {
                    needSize = this.childSizeCache[child];
                }
                else
                {
                    needSize = child.MeasureOverride(new SizeF(nfloat.PositiveInfinity, nfloat.PositiveInfinity));
                    this.childSizeCache[child] = needSize;
                }

                child.Arrange(new RectangleF((nfloat)Canvas.GetLeft(child), (nfloat)Canvas.GetTop(child), needSize.Width, needSize.Height));
            }
        }
 public void ArrangeItemAtPosition(UIElement child, int index)
 {
     child.MeasureOverride(this.arrangedSize);
     child.Arrange(this.GetChildRect(index));
 }
 public void ArrangeItemAtPosition(UIElement child, int index)
 {
     child.MeasureOverride(this.arrangedSize);
     child.Arrange(this.GetChildRect(index));
 }
 public void ArrangeItemAtPosition(UIElement child, int index)
 {
     child.MeasureOverride(this.arrangedSize);
     var rect = new RectangleF(new PointF(index * this.arrangedSize.Width, 0), this.arrangedSize);
     child.Arrange(rect);
 }