ArcGISPortalViewer.Controls.Primitives.UniformGrid.MeasureOverride C# (CSharp) Method

MeasureOverride() protected method

Compute the desired size of the UniformGrid by measuring all of the children with a constraint equal to a cell's portion of the given constraint. The maximum child width and maximum child height are tracked, and then the desired size is computed by multiplying these maximums by the row and column count.
protected MeasureOverride ( Size constraint ) : Size
constraint Windows.Foundation.Size The size constraint.
return Windows.Foundation.Size
        protected override Size MeasureOverride(Size constraint)
        {
            UpdateComputedValues();

            Size childConstraint = new Size(constraint.Width / ComputedColumns, constraint.Height / ComputedRows);
            double maxChildDesiredWidth = 0.0;
            double maxChildDesiredHeight = 0.0;

            //  Measure each child, keeping track of max desired width & height.
            for (int i = 0, count = Children.Count; i < count; ++i)
            {
                UIElement child = Children[i];
                child.Measure(childConstraint);
                Size childDesiredSize = child.DesiredSize;
                if (maxChildDesiredWidth < childDesiredSize.Width)
                {
                    maxChildDesiredWidth = childDesiredSize.Width;
                }
                if (maxChildDesiredHeight < childDesiredSize.Height)
                {
                    maxChildDesiredHeight = childDesiredSize.Height;
                }
            }
            return new Size((maxChildDesiredWidth * ComputedColumns), (maxChildDesiredHeight * ComputedRows));
        }