protected override Size ArrangeOverride(Size finalSize) { Rect finalRect = new Rect(0.0, 0.0, finalSize.Width, finalSize.Height); foreach (UIElement internalChild in this.InternalChildren) { if (internalChild != null) { double actualSplitterLength = SplitterPanel.GetActualSplitterLength(internalChild); if (this.Orientation == Orientation.Horizontal) { finalRect.Width = actualSplitterLength; internalChild.Arrange(finalRect); finalRect.X += actualSplitterLength; } else { finalRect.Height = actualSplitterLength; internalChild.Arrange(finalRect); finalRect.Y += actualSplitterLength; } } } return(finalSize); }
private bool ResizeChildrenCore(SplitterMeasureData child1, SplitterMeasureData child2, double pixelAmount) { UIElement element1 = child1.Element; UIElement element2 = child2.Element; SplitterLength attachedLength1 = child1.AttachedLength; SplitterLength attachedLength2 = child2.AttachedLength; double actualSplitterLength1 = SplitterPanel.GetActualSplitterLength(element1); double actualSplitterLength2 = SplitterPanel.GetActualSplitterLength(element2); double num1 = Math.Max(0.0, Math.Min(actualSplitterLength1 + actualSplitterLength2, actualSplitterLength1 + pixelAmount)); double num2 = Math.Max(0.0, Math.Min(actualSplitterLength1 + actualSplitterLength2, actualSplitterLength2 - pixelAmount)); double minimumLength1 = SplitterPanel.GetMinimumLength(element1); double minimumLength2 = SplitterPanel.GetMinimumLength(element2); if (minimumLength1 + minimumLength2 > num1 + num2) { return(false); } if (num1 < minimumLength1) { num2 -= minimumLength1 - num1; num1 = minimumLength1; } if (num2 < minimumLength2) { num1 -= minimumLength2 - num2; num2 = minimumLength2; } if (attachedLength1.IsFill && attachedLength2.IsFill || attachedLength1.IsStretch && attachedLength2.IsStretch) { SplitterMeasureData splitterMeasureData = child1; double num3 = num1; SplitterLength splitterLength = new SplitterLength(num3 / (num3 + num2) * (attachedLength1.Value + attachedLength2.Value), attachedLength1.SplitterUnitType); splitterMeasureData.AttachedLength = splitterLength; child2.AttachedLength = new SplitterLength(num2 / (num1 + num2) * (attachedLength1.Value + attachedLength2.Value), attachedLength1.SplitterUnitType); } else if (attachedLength1.IsFill) { child2.AttachedLength = new SplitterLength(num2, SplitterUnitType.Stretch); } else { child1.AttachedLength = new SplitterLength(num1, SplitterUnitType.Stretch); } return(true); }