private Record ComputeChildSize(UIElement child, Orientation orientation, ref Size finalSize, ref double totalLength, ref double starTotal) { var sizeHint = GetChildSizeHint(child); var size = new Size(); if (GridLengthHelper2.GetIsStar(sizeHint)) { starTotal += sizeHint.Value; } else if (GridLengthHelper2.GetIsAuto(sizeHint)) { ComputeChildAutoSize(child, orientation, ref finalSize, ref totalLength, ref size); } else if (GridLengthHelper2.GetIsAbsolute(sizeHint)) { ComputeChildAbsoluteSize(orientation, ref finalSize, ref totalLength, ref sizeHint, ref size); } return(new Record { Child = child, Size = size, SizeHint = sizeHint, }); }
private void MeasureStarChildren(Size availableSize, Orientation orientation, ref Size totalSize, double starTotal, UIElement[] children) { if (starTotal != 0) { foreach (UIElement child in children) { var sizeHint = GetChildSizeHint(child); if (GridLengthHelper2.GetIsStar(sizeHint)) { MesureChildStar(child, orientation, availableSize, sizeHint, starTotal, ref totalSize); } } } }
private void MeasureChild(UIElement child, Size availableSize, Orientation orientation, ref Size totalSize, ref double starTotal) { var sizeHint = GetChildSizeHint(child); if (GridLengthHelper2.GetIsStar(sizeHint)) { starTotal += sizeHint.Value; } else if (GridLengthHelper2.GetIsAuto(sizeHint)) { MesureChildAuto(child, orientation, availableSize, ref totalSize); } else if (GridLengthHelper2.GetIsAbsolute(sizeHint)) { MesureChildAbsolute(child, orientation, availableSize, sizeHint, ref totalSize); } }
private static Size ComputeFinalChildSize(Record record, Orientation orientation, ref Size finalSize, double starRatio) { var size = record.Size; if (GridLengthHelper2.GetIsStar(record.SizeHint)) { var portion = record.SizeHint.Value * starRatio; if (orientation == Orientation.Vertical) { size.Width = finalSize.Width; size.Height = portion; } else { size.Width = portion; size.Height = finalSize.Height; } } return(size); }