예제 #1
0
            sw.Size MeasureChildren(sw.Size constraint)
            {
                var size = new sw.Size();

                foreach (sw.UIElement control in Children)
                {
                    control.Measure(constraint);
                    var preferredSize = control.DesiredSize;
                    var left          = GetLeft(control) + preferredSize.Width;
                    var top           = GetTop(control) + preferredSize.Height;
                    if (size.Width < left)
                    {
                        size.Width = left;
                    }
                    if (size.Height < top)
                    {
                        size.Height = top;
                    }
                }
                return(size.Min(constraint.InfinityIfNan()));
            }
예제 #2
0
        protected override Size MeasureOverride(Size constraint)
        { 
            if (null == ScrollOwner || _contentRoot == null)
                return base.MeasureOverride(constraint);

            Size ideal = new Size (
                CanHorizontallyScroll ? double.PositiveInfinity : constraint.Width,
                CanVerticallyScroll ? double.PositiveInfinity : constraint.Height
            );

            _contentRoot.Measure (ideal);
            UpdateExtents (constraint, _contentRoot.DesiredSize);

            return constraint.Min (extents);
        }