Пример #1
0
        public override Size MeasureOverride(IPanelAdapter adapter, Size availaibleSize)
        {
            if (adapter.ChildrenCount < 1)
            {
                return(new Size(1, 1));
            }

            // measure the first Child
            adapter.Measure(0, availaibleSize);
            var firstSize = adapter.GetDesiredSize(0);

            for (int i = 1; i < adapter.ChildrenCount; i++)
            {
                adapter.Measure(i, firstSize);
            }
            return(firstSize);
        }
        public override Size MeasureOverride(IPanelAdapter adapter, Size availaibleSize)
        {
            measurements.Clear();
            var cellSize = new Size();

            for (int i = 0; i < adapter.ChildrenCount; i++)
            {
                if (i % Columns == 0)
                {
                    cellSize = new Size(availaibleSize.Width / Columns,
                                        availaibleSize.Height - measurements.Sum(j => j.RowHeight));
                    measurements.Add(new MeasurementRowHeight());
                }
                adapter.Measure(i, cellSize);
                measurements.Last().AddItem(i, adapter.GetDesiredSize(i).Height);
            }

            return(new Size(availaibleSize.Width, measurements.Sum(i => i.RowHeight)));
        }
Пример #3
0
 public static void Measure(this IPanelAdapter adapter, int child, double width, double height) =>
 adapter.Measure(child, new Size(width, height));