protected override Size MeasureOverride(Size availableSize) { totalWeight_ = 0; foreach (UIElement child in InternalChildren) { totalWeight_ += WeightedPanel.GetWeight(child); child.Measure(availableSize); } return(new Size(0, 0)); }
protected override Size ArrangeOverride(Size finalSize) { double offset = 0; foreach (UIElement child in InternalChildren) { var weight = WeightedPanel.GetWeight(child); var height = finalSize.Height * weight / totalWeight_; child.Arrange(new Rect(new Point(0, offset), new Size(finalSize.Width, height))); offset += height; } return(finalSize); }