/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { DigestDataBoundContentProperties(); var content = Content; var contentElement = content as UIElement; if (contentElement != null) { var contentElementRect = new RectangleD(0, 0, finalSize.Width, finalSize.Height); contentElement.Arrange(contentElementRect, options); return(finalSize); } else { if (textParserResult != null && textParserResult.Count > 0) { if (textLayoutCommands.Settings.Width != finalSize.Width || textLayoutCommands.Settings.Height != finalSize.Height) { UpdateTextLayoutCache(finalSize); } return(finalSize); } } return(Size2D.Zero); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { // Calculate the sizes of the track's components. var thumbSize = CalculateThumbSize(finalSize); var decreaseButtonSize = CalculateDecreaseButtonSize(finalSize, thumbSize); var increaseButtonSize = CalculateIncreaseButtonSize(finalSize, decreaseButtonSize, thumbSize); // Arrange the track's components. var position = new Point2D(0, 0); var orientation = this.Orientation; if (IsDirectionReversed) { increaseRepeatButton.Arrange(new RectangleD(position, increaseButtonSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(increaseButtonSize.Width, 0) : new Point2D(0, increaseButtonSize.Height); thumb.Arrange(new RectangleD(position, thumbSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(thumbSize.Width, 0) : new Point2D(0, thumbSize.Height); decreaseRepeatButton.Arrange(new RectangleD(position, decreaseButtonSize)); } else { decreaseRepeatButton.Arrange(new RectangleD(position, decreaseButtonSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(decreaseButtonSize.Width, 0) : new Point2D(0, decreaseButtonSize.Height); thumb.Arrange(new RectangleD(position, thumbSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(thumbSize.Width, 0) : new Point2D(0, thumbSize.Height); increaseRepeatButton.Arrange(new RectangleD(position, increaseButtonSize)); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (TemplatedParent == null) { return(finalSize); } var scrollableHorizontally = CanScrollHorizontally && extentWidth > viewportWidth; var scrollableVertically = CanScrollVertically && extentHeight > viewportHeight; var contentFinalSize = new Size2D( scrollableHorizontally ? extentWidth : finalSize.Width, scrollableVertically ? extentHeight : finalSize.Height ); var contentSize = base.ArrangeOverride(contentFinalSize, options); var presenterSize = finalSize; extentWidth = contentSize.Width; extentHeight = contentSize.Height; viewportWidth = presenterSize.Width; viewportHeight = presenterSize.Height; return(presenterSize); }
/// <summary> /// Arranges the panel when it is oriented horizontally. /// </summary> /// <param name="finalSize">The element's final relative to its parent element.</param> /// <param name="options">A set of <see cref="ArrangeOptions"/> values specifying the options for this arrangement.</param> /// <returns>The panel's size after arrangement.</returns> private Size2D ArrangeHorizontally(Size2D finalSize, ArrangeOptions options) { var index = 0; var positionX = 0.0; var positionY = 0.0; var rowCount = 0; var rowWidth = 0.0; var rowHeight = 0.0; while (CalculateRowProperties(finalSize, index, out rowCount, out rowWidth, out rowHeight)) { for (int i = 0; i < rowCount; i++) { var child = Children[index + i]; var childRect = new RectangleD(positionX, positionY, child.DesiredSize.Width, rowHeight); child.Arrange(childRect); positionX += childRect.Width; } positionX = 0; positionY = positionY + rowHeight; index += rowCount; } return(finalSize); }
/// <summary> /// Arranges the panel when it is oriented vertically. /// </summary> /// <param name="finalSize">The element's final size after arrangement.</param> /// <param name="options">A set of <see cref="ArrangeOptions"/> values specifying the options for this arrangement.</param> /// <returns>The panel's size after arrangement.</returns> private Size2D ArrangeVertically(Size2D finalSize, ArrangeOptions options) { var index = 0; var positionX = 0.0; var positionY = 0.0; var colCount = 0; var colWidth = 0.0; var colHeight = 0.0; while (CalculateColumnProperties(finalSize, index, out colCount, out colWidth, out colHeight)) { for (int i = 0; i < colCount; i++) { var child = Children[index + i]; var childRect = new RectangleD(positionX, positionY, colWidth, child.DesiredSize.Height); child.Arrange(childRect); positionY += childRect.Height; } positionX = positionX + colWidth; positionY = 0; index += colCount; } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (child != null) { child.Arrange(new RectangleD(Point2D.Zero, finalSize), options); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (child != null) { child.Arrange(new RectangleD(Point2D.Zero, finalSize), options); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var sizeLeft = 0.0; var sizeTop = 0.0; var sizeRight = 0.0; var sizeBottom = 0.0; var childWidth = 0.0; var childHeight = 0.0; var lastChildFill = LastChildFill; for (int i = 0; i < Children.Count; i++) { var child = Children[i]; var isLastChild = (i == Children.Count - 1); var remainingWidth = finalSize.Width - (sizeLeft + sizeRight); var remainingHeight = finalSize.Height - (sizeTop + sizeBottom); var childRect = RectangleD.Empty; switch (GetDock(child)) { case Dock.Left: childWidth = isLastChild && lastChildFill ? remainingWidth : Math.Min(child.DesiredSize.Width, remainingWidth); childHeight = remainingHeight; childRect = new RectangleD(sizeLeft, sizeTop, childWidth, childHeight); sizeLeft = sizeLeft + childRect.Width; break; case Dock.Top: childWidth = remainingWidth; childHeight = isLastChild && lastChildFill ? remainingHeight : Math.Min(child.DesiredSize.Height, remainingHeight); childRect = new RectangleD(sizeLeft, sizeTop, childWidth, childHeight); sizeTop = sizeTop + childRect.Height; break; case Dock.Right: childWidth = isLastChild && lastChildFill ? remainingWidth : Math.Min(child.DesiredSize.Width, remainingWidth); childHeight = remainingHeight; childRect = new RectangleD(finalSize.Width - (sizeRight + childWidth), sizeTop, childWidth, childHeight); sizeRight = sizeRight + childRect.Width; break; case Dock.Bottom: childWidth = remainingWidth; childHeight = isLastChild && lastChildFill ? remainingHeight : Math.Min(child.DesiredSize.Height, remainingHeight); childRect = new RectangleD(sizeLeft, finalSize.Height - (sizeBottom + childHeight), childWidth, childHeight); sizeBottom = sizeBottom + childRect.Height; break; } child.Arrange(childRect); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var arrangedSize = base.ArrangeOverride(finalSize, options); if (VisualTreeHelper.GetParent(adornerLayer) == this) { adornerLayer.Arrange(new RectangleD(Point2D.Zero, finalSize)); } return arrangedSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (textLayoutCommands.Settings.Width != finalSize.Width || textLayoutCommands.Settings.Height != finalSize.Height) { UpdateTextLayoutResult(finalSize); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var arrangedSize = base.ArrangeOverride(finalSize, options); if (VisualTreeHelper.GetParent(adornerLayer) == this) { adornerLayer.Arrange(new RectangleD(Point2D.Zero, finalSize)); } return(arrangedSize); }
/// <inheritdoc/> protected override Size2D ArrangeCore(RectangleD finalRect, ArrangeOptions options) { if (clonedElement != null) { if (!clonedElement.IsVisuallyConnectedToViewRoot) { clonedElement.Arrange(new RectangleD(0, 0, clonedElement.DesiredSize.Width, clonedElement.DesiredSize.Height)); } clonedBounds = clonedElement.TransformedVisualBounds; return(finalRect.Size); } return(base.ArrangeCore(finalRect, options)); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (Orientation == Orientation.Vertical) { finalSize = ArrangeVertically(finalSize, options); } else { finalSize = ArrangeHorizontally(finalSize, options); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (Orientation == Orientation.Vertical) { finalSize = ArrangeVertically(finalSize, options); } else { finalSize = ArrangeHorizontally(finalSize, options); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeCore(RectangleD finalRect, ArrangeOptions options) { if (clonedElement != null) { if (!clonedElement.IsVisuallyConnectedToViewRoot) { clonedElement.Arrange(new RectangleD(0, 0, clonedElement.DesiredSize.Width, clonedElement.DesiredSize.Height)); } clonedBounds = clonedElement.TransformedVisualBounds; return finalRect.Size; } return base.ArrangeCore(finalRect, options); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (componentRoot == null) { var finalWidth = Double.IsPositiveInfinity(finalSize.Width) ? 0 : finalSize.Width; var finalHeight = Double.IsPositiveInfinity(finalSize.Height) ? 0 : finalSize.Height; return(new Size2D(finalWidth, finalHeight)); } var finalRect = new RectangleD(Point2D.Zero, finalSize); componentRoot.Arrange(finalRect, options); return(componentRoot.RenderSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var totalPadding = BorderThickness + Padding; var totalPaddingWidth = totalPadding.Left + totalPadding.Right; var totalPaddingHeight = totalPadding.Top + totalPadding.Bottom; var child = Child; if (child != null) { var childArrangeRect = new RectangleD( totalPadding.Left, totalPadding.Right, Math.Max(0, finalSize.Width - totalPaddingWidth), Math.Max(0, finalSize.Height - totalPaddingHeight)); child.Arrange(childArrangeRect, options); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var layerParent = VisualTreeHelper.GetParent(this) as Visual; for (int i = 0; i < adorners.Count; i++) { var state = adornersStates[i]; var adorner = (Adorner)adorners[i]; var adornedElement = adorner.AdornedElement; state.LastAbsoluteX = adornedElement.UntransformedAbsolutePosition.X; state.LastAbsoluteY = adornedElement.UntransformedAbsolutePosition.Y; state.LastRenderWidth = adornedElement.RenderSize.Width; state.LastRenderHeight = adornedElement.RenderSize.Height; var transformMatrix = adornedElement.GetTransformToAncestorMatrix(layerParent); state.LastTransform = transformMatrix; adorner.GetDesiredTransform(ref transformMatrix); if (!IsUnderTransform(adornedElement)) { transformMatrix = new Matrix( transformMatrix.M11, transformMatrix.M12, transformMatrix.M13, (Int32)transformMatrix.M14, transformMatrix.M21, transformMatrix.M22, transformMatrix.M23, (Int32)transformMatrix.M24, transformMatrix.M31, transformMatrix.M32, transformMatrix.M33, (Int32)transformMatrix.M34, transformMatrix.M41, transformMatrix.M42, transformMatrix.M43, transformMatrix.M44); } var transformObject = adorner.RenderTransform as MatrixTransform ?? new MatrixTransform(); transformObject.Matrix = transformMatrix; adorner.RenderTransformOrigin = Point2D.Zero; adorner.RenderTransform = transformObject; var adornerRect = new RectangleD(Point2D.Zero, adorner.DesiredSize); adorner.Arrange(adornerRect); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var totalPadding = BorderThickness + Padding; var totalPaddingWidth = totalPadding.Left + totalPadding.Right; var totalPaddingHeight = totalPadding.Top + totalPadding.Bottom; var child = Child; if (child != null) { var childArrangeRect = new RectangleD( totalPadding.Left, totalPadding.Right, Math.Max(0, finalSize.Width - totalPaddingWidth), Math.Max(0, finalSize.Height - totalPaddingHeight)); child.Arrange(childArrangeRect, options); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { PrepareForArrange(ColumnDefinitions); PrepareForArrange(RowDefinitions); FinalizeDimension(ColumnDefinitions, finalSize.Width); FinalizeDimension(RowDefinitions, finalSize.Height); foreach (var cell in virtualCells) { var childElement = cell.Element; var childColumn = ColumnDefinitions[cell.ColumnIndex]; var childRow = RowDefinitions[cell.RowIndex]; var childArea = new RectangleD(childColumn.Position, childRow.Position, Math.Max(0, CalculateSpanDimension(ColumnDefinitions, cell.ColumnIndex, cell.ColumnSpan)), Math.Max(0, CalculateSpanDimension(RowDefinitions, cell.RowIndex, cell.RowSpan))); childElement.Arrange(childArea); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var positionX = 0.0; var positionY = 0.0; if (Orientation == Orientation.Vertical) { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, child.DesiredSize.Height)); positionY += child.DesiredSize.Height; } } else { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, child.DesiredSize.Width, finalSize.Height)); positionX += child.DesiredSize.Width; } } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var positionX = 0.0; var positionY = 0.0; if (Orientation == Orientation.Vertical) { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, child.DesiredSize.Height)); positionY += child.DesiredSize.Height; } } else { foreach (var child in Children) { child.Arrange(new RectangleD(positionX, positionY, child.DesiredSize.Width, finalSize.Height)); positionX += child.DesiredSize.Width; } } return(finalSize); }
/// <summary> /// Arranges the panel when it is oriented horizontally. /// </summary> /// <param name="finalSize">The element's final relative to its parent element.</param> /// <param name="options">A set of <see cref="ArrangeOptions"/> values specifying the options for this arrangement.</param> /// <returns>The panel's size after arrangement.</returns> private Size2D ArrangeHorizontally(Size2D finalSize, ArrangeOptions options) { var index = 0; var positionX = 0.0; var positionY = 0.0; var rowCount = 0; var rowWidth = 0.0; var rowHeight = 0.0; while (CalculateRowProperties(finalSize, index, out rowCount, out rowWidth, out rowHeight)) { for (int i = 0; i < rowCount; i++) { var child = Children[index + i]; var childRect = new RectangleD(positionX, positionY, child.DesiredSize.Width, rowHeight); child.Arrange(childRect); positionX += childRect.Width; } positionX = 0; positionY = positionY + rowHeight; index += rowCount; } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var placement = ControlTabStripPlacement; if (placement == Dock.Top || placement == Dock.Bottom) { var stretchRows = (rowCount > 1); var rowStart = 0; var rowEnd = 0; var rowWidth = 0.0; var positionX = 0.0; var positionY = 0.0; var owner = TemplatedParent as Selector; var ownerSelectedIndex = (owner == null) ? -1 : owner.SelectedIndex; var selectedRowHeight = (ownerSelectedIndex >= 0) ? maxItemHeight : 0.0; while (rowStart < Children.Count) { FindNextRowOfTabs(finalSize, rowStart, ref rowEnd, out rowWidth); var rowIsSelected = ownerSelectedIndex >= rowStart && ownerSelectedIndex <= rowEnd; var rowTabCount = 1 + (rowEnd - rowStart); var rowWidthExcess = stretchRows ? (finalSize.Width - rowWidth) / rowTabCount : 0.0; var rowWidthTotal = 0.0; for (int i = rowStart; i <= rowEnd; i++) { var actualPositionX = positionX; var actualPositionY = (placement == Dock.Top) ? (rowIsSelected ? finalSize.Height - selectedRowHeight : positionY) : (rowIsSelected ? 0 : positionY + selectedRowHeight); var child = Children[i]; var childDesiredSize = child.DesiredSize - child.GetValue<Thickness>(MarginProperty); var childWidth = PerformLayoutRounding(childDesiredSize.Width + rowWidthExcess); var childHeight = maxItemHeight; rowWidthTotal += childWidth; var isLastInRow = (i == rowEnd); if (isLastInRow && stretchRows) { childWidth += (finalSize.Width - rowWidthTotal); } child.Arrange(new RectangleD(actualPositionX, actualPositionY, childWidth, childHeight)); positionX += childWidth; } rowStart = rowEnd + 1; positionX = 0; positionY = rowIsSelected ? positionY : positionY + maxItemHeight; } } else { var positionX = 0.0; var positionY = 0.0; foreach (var child in Children) { var childDesiredSize = (child.DesiredSize - child.GetValue<Thickness>(MarginProperty)); child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, childDesiredSize.Height)); positionY += childDesiredSize.Height; } } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (textLayoutCommands.Settings.Width != finalSize.Width || textLayoutCommands.Settings.Height != finalSize.Height) UpdateTextLayoutResult(finalSize); return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { UpdatePopupArrange(root.DesiredSize); return Size2D.Zero; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { // Calculate the sizes of the track's components. var thumbSize = CalculateThumbSize(finalSize); var decreaseButtonSize = CalculateDecreaseButtonSize(finalSize, thumbSize); var increaseButtonSize = CalculateIncreaseButtonSize(finalSize, decreaseButtonSize, thumbSize); // Arrange the track's components. var position = new Point2D(0, 0); var orientation = this.Orientation; DecreaseButton.Arrange(new RectangleD(position, decreaseButtonSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(decreaseButtonSize.Width, 0) : new Point2D(0, decreaseButtonSize.Height); Thumb.Arrange(new RectangleD(position, thumbSize)); position += (orientation == Orientation.Horizontal) ? new Point2D(thumbSize.Width, 0) : new Point2D(0, thumbSize.Height); IncreaseButton.Arrange(new RectangleD(position, increaseButtonSize)); return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { PrepareForArrange(ColumnDefinitions); PrepareForArrange(RowDefinitions); FinalizeDimension(ColumnDefinitions, finalSize.Width); FinalizeDimension(RowDefinitions, finalSize.Height); foreach (var cell in virtualCells) { var childElement = cell.Element; var childColumn = ColumnDefinitions[cell.ColumnIndex]; var childRow = RowDefinitions[cell.RowIndex]; var childArea = new RectangleD(childColumn.Position, childRow.Position, CalculateSpanDimension(ColumnDefinitions, cell.ColumnIndex, cell.ColumnSpan), CalculateSpanDimension(RowDefinitions, cell.RowIndex, cell.RowSpan)); childElement.Arrange(childArea); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var placement = ControlTabStripPlacement; if (placement == Dock.Top || placement == Dock.Bottom) { var stretchRows = (rowCount > 1); var rowStart = 0; var rowEnd = 0; var rowWidth = 0.0; var positionX = 0.0; var positionY = 0.0; var owner = TemplatedParent as Selector; var ownerSelectedIndex = (owner == null) ? -1 : owner.SelectedIndex; var selectedRowHeight = (ownerSelectedIndex >= 0) ? maxItemHeight : 0.0; while (rowStart < Children.Count) { FindNextRowOfTabs(finalSize, rowStart, ref rowEnd, out rowWidth); var rowIsSelected = ownerSelectedIndex >= rowStart && ownerSelectedIndex <= rowEnd; var rowTabCount = 1 + (rowEnd - rowStart); var rowWidthExcess = stretchRows ? (finalSize.Width - rowWidth) / rowTabCount : 0.0; var rowWidthTotal = 0.0; for (int i = rowStart; i <= rowEnd; i++) { var actualPositionX = positionX; var actualPositionY = (placement == Dock.Top) ? (rowIsSelected ? finalSize.Height - selectedRowHeight : positionY) : (rowIsSelected ? 0 : positionY + selectedRowHeight); var child = Children[i]; var childDesiredSize = child.DesiredSize - child.GetValue <Thickness>(MarginProperty); var childWidth = PerformLayoutRounding(childDesiredSize.Width + rowWidthExcess); var childHeight = maxItemHeight; rowWidthTotal += childWidth; var isLastInRow = (i == rowEnd); if (isLastInRow && stretchRows) { childWidth += (finalSize.Width - rowWidthTotal); } child.Arrange(new RectangleD(actualPositionX, actualPositionY, childWidth, childHeight)); positionX += childWidth; } rowStart = rowEnd + 1; positionX = 0; positionY = rowIsSelected ? positionY : positionY + maxItemHeight; } } else { var positionX = 0.0; var positionY = 0.0; foreach (var child in Children) { var childDesiredSize = (child.DesiredSize - child.GetValue <Thickness>(MarginProperty)); child.Arrange(new RectangleD(positionX, positionY, finalSize.Width, childDesiredSize.Height)); positionY += childDesiredSize.Height; } } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { return base.ArrangeOverride(finalSize, options); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { return(base.ArrangeOverride(finalSize, options)); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (TemplatedParent == null) return finalSize; var scrollableHorizontally = CanScrollHorizontally && extentWidth > viewportWidth; var scrollableVertically = CanScrollVertically && extentHeight > viewportHeight; var contentFinalSize = new Size2D( scrollableHorizontally ? extentWidth : finalSize.Width, scrollableVertically ? extentHeight : finalSize.Height ); var contentSize = base.ArrangeOverride(contentFinalSize, options); var presenterSize = finalSize; extentWidth = contentSize.Width; extentHeight = contentSize.Height; viewportWidth = presenterSize.Width; viewportHeight = presenterSize.Height; return presenterSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { UpdateSelectionAndCaret(); return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var layerParent = VisualTreeHelper.GetParent(this) as Visual; for (int i = 0; i < adorners.Count; i++) { var state = adornersStates[i]; var adorner = (Adorner)adorners[i]; var adornedElement = adorner.AdornedElement; state.LastAbsoluteX = adornedElement.UntransformedAbsolutePosition.X; state.LastAbsoluteY = adornedElement.UntransformedAbsolutePosition.Y; state.LastRenderWidth = adornedElement.RenderSize.Width; state.LastRenderHeight = adornedElement.RenderSize.Height; var transformMatrix = adornedElement.GetTransformToAncestorMatrix(layerParent); state.LastTransform = transformMatrix; adorner.GetDesiredTransform(ref transformMatrix); var transformObject = adorner.RenderTransform as MatrixTransform ?? new MatrixTransform(); transformObject.Matrix = transformMatrix; adorner.RenderTransformOrigin = Point2D.Zero; adorner.RenderTransform = transformObject; var adornerRect = new RectangleD(Point2D.Zero, adorner.DesiredSize); adorner.Arrange(adornerRect); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { return finalSize; }
/// <inheritdoc/> protected sealed override Size2D ArrangeCore(RectangleD finalRect, ArrangeOptions options) { var margin = PerformLayoutRounding(Margin); var finalRectSansMargins = finalRect - margin; var desiredWidth = DesiredSize.Width; var desiredHeight = DesiredSize.Height; var hAlign = HorizontalAlignment; var vAlign = VerticalAlignment; if (Double.IsNaN(Width) && hAlign == HorizontalAlignment.Stretch) desiredWidth = Math.Max(MinWidth, Math.Min(MaxWidth, finalRect.Width)); if (Double.IsNaN(Height) && vAlign == VerticalAlignment.Stretch) desiredHeight = Math.Max(MinHeight, Math.Min(MaxHeight, finalRect.Height)); if (isLayoutTransformed) { desiredWidth = layoutTransformSizeDesiredBeforeTransform.Width; desiredHeight = layoutTransformSizeDesiredBeforeTransform.Height; var arrangedSizeAfterLayoutTransform = CalculateMaximumAvailableSizeBeforeLayoutTransform(desiredWidth, desiredHeight, layoutTransformUsedDuringLayout); if (MathUtil.IsApproximatelyGreaterThanOrEqual(arrangedSizeAfterLayoutTransform.Width, layoutTransformSizeDesiredBeforeTransform.Width) && MathUtil.IsApproximatelyGreaterThanOrEqual(arrangedSizeAfterLayoutTransform.Height, layoutTransformSizeDesiredBeforeTransform.Height)) { desiredWidth = arrangedSizeAfterLayoutTransform.Width; desiredHeight = arrangedSizeAfterLayoutTransform.Height; } desiredWidth = desiredWidth + margin.Left + margin.Right; desiredHeight = desiredHeight + margin.Top + margin.Bottom; } var desiredSize = new Size2D(desiredWidth, desiredHeight); var candidateSize = desiredSize - margin; candidateSize = PerformLayoutRounding(candidateSize); var usedSize = ArrangeOverride(candidateSize, options); usedSize = PerformLayoutRounding(usedSize); var usedWidth = Math.Min(usedSize.Width, candidateSize.Width); var usedHeight = Math.Min(usedSize.Height, candidateSize.Height); usedSize = new Size2D(usedWidth, usedHeight); var untransformedUsedSize = usedSize; var xOffset = 0.0; var yOffset = 0.0; if (isLayoutTransformed) { RectangleD area = new RectangleD(0, 0, usedWidth, usedHeight); RectangleD.TransformAxisAligned(ref area, ref layoutTransformUsedDuringLayout, out area); usedSize = new Size2D(area.Width, area.Height); xOffset -= area.X; yOffset -= area.Y; } xOffset += margin.Left + LayoutUtil.PerformHorizontalAlignment(finalRectSansMargins.Size, usedSize, hAlign); yOffset += margin.Top + LayoutUtil.PerformVerticalAlignment(finalRectSansMargins.Size, usedSize, vAlign); RenderOffset = new Point2D(xOffset, yOffset); return untransformedUsedSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { foreach (var child in Children) { var left = GetLeft(child); var top = GetTop(child); var right = GetRight(child); var bottom = GetBottom(child); if (Double.IsNaN(left) && Double.IsNaN(right)) left = 0; if (Double.IsNaN(top) && Double.IsNaN(bottom)) top = 0; var validLeft = LayoutUtil.GetValidMeasure(left, 0); var validTop = LayoutUtil.GetValidMeasure(top, 0); var validRight = LayoutUtil.GetValidMeasure(right, 0); var validBottom = LayoutUtil.GetValidMeasure(bottom, 0); var childWidth = Math.Min(child.DesiredSize.Width, finalSize.Width - (validLeft + validRight)); var childHeight = Math.Min(child.DesiredSize.Height, finalSize.Height - (validTop + validBottom)); if (!Double.IsNaN(left) && !Double.IsNaN(right)) childWidth = Math.Max(0, finalSize.Width - (left + right)); if (!Double.IsNaN(top) && !Double.IsNaN(bottom)) childHeight = Math.Max(0, finalSize.Height - (top + bottom)); var childX = 0.0; var childY = 0.0; if (!Double.IsNaN(left)) childX = left; if (!Double.IsNaN(top)) childY = top; if (!Double.IsNaN(right)) childX = finalSize.Width - (right + childWidth); if (!Double.IsNaN(bottom)) childY = finalSize.Height - (bottom + childHeight); child.Arrange(new RectangleD(childX, childY, childWidth, childHeight)); } return finalSize; }
/// <summary> /// Arranges the panel when it is oriented vertically. /// </summary> /// <param name="finalSize">The element's final size after arrangement.</param> /// <param name="options">A set of <see cref="ArrangeOptions"/> values specifying the options for this arrangement.</param> /// <returns>The panel's size after arrangement.</returns> private Size2D ArrangeVertically(Size2D finalSize, ArrangeOptions options) { var index = 0; var positionX = 0.0; var positionY = 0.0; var colCount = 0; var colWidth = 0.0; var colHeight = 0.0; while (CalculateColumnProperties(finalSize, index, out colCount, out colWidth, out colHeight)) { for (int i = 0; i < colCount; i++) { var child = Children[index + i]; var childRect = new RectangleD(positionX, positionY, colWidth, child.DesiredSize.Height); child.Arrange(childRect); positionY += childRect.Height; } positionX = positionX + colWidth; positionY = 0; index += colCount; } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { var sizeLeft = 0.0; var sizeTop = 0.0; var sizeRight = 0.0; var sizeBottom = 0.0; var childWidth = 0.0; var childHeight = 0.0; var lastChildFill = LastChildFill; for (int i = 0; i < Children.Count; i++) { var child = Children[i]; var isLastChild = (i == Children.Count - 1); var remainingWidth = finalSize.Width - (sizeLeft + sizeRight); var remainingHeight = finalSize.Height - (sizeTop + sizeBottom); var childRect = RectangleD.Empty; switch (GetDock(child)) { case Dock.Left: childWidth = isLastChild && lastChildFill ? remainingWidth : Math.Min(child.DesiredSize.Width, remainingWidth); childHeight = remainingHeight; childRect = new RectangleD(sizeLeft, sizeTop, childWidth, childHeight); sizeLeft = sizeLeft + childRect.Width; break; case Dock.Top: childWidth = remainingWidth; childHeight = isLastChild && lastChildFill ? remainingHeight : Math.Min(child.DesiredSize.Height, remainingHeight); childRect = new RectangleD(sizeLeft, sizeTop, childWidth, childHeight); sizeTop = sizeTop + childRect.Height; break; case Dock.Right: childWidth = isLastChild && lastChildFill ? remainingWidth : Math.Min(child.DesiredSize.Width, remainingWidth); childHeight = remainingHeight; childRect = new RectangleD(finalSize.Width - (sizeRight + childWidth), sizeTop, childWidth, childHeight); sizeRight = sizeRight + childRect.Width; break; case Dock.Bottom: childWidth = remainingWidth; childHeight = isLastChild && lastChildFill ? remainingHeight : Math.Min(child.DesiredSize.Height, remainingHeight); childRect = new RectangleD(sizeLeft, finalSize.Height - (sizeBottom + childHeight), childWidth, childHeight); sizeBottom = sizeBottom + childRect.Height; break; } child.Arrange(childRect); } return finalSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { nonLogicalAdornerDecorator.Arrange(new RectangleD(Point2D.Zero, finalSize), options); return nonLogicalAdornerDecorator.RenderSize; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { foreach (var child in Children) { var left = GetLeft(child); var top = GetTop(child); var right = GetRight(child); var bottom = GetBottom(child); if (Double.IsNaN(left) && Double.IsNaN(right)) { left = 0; } if (Double.IsNaN(top) && Double.IsNaN(bottom)) { top = 0; } var validLeft = LayoutUtil.GetValidMeasure(left, 0); var validTop = LayoutUtil.GetValidMeasure(top, 0); var validRight = LayoutUtil.GetValidMeasure(right, 0); var validBottom = LayoutUtil.GetValidMeasure(bottom, 0); var childWidth = Math.Min(child.DesiredSize.Width, finalSize.Width - (validLeft + validRight)); var childHeight = Math.Min(child.DesiredSize.Height, finalSize.Height - (validTop + validBottom)); if (!Double.IsNaN(left) && !Double.IsNaN(right)) { childWidth = Math.Max(0, finalSize.Width - (left + right)); } if (!Double.IsNaN(top) && !Double.IsNaN(bottom)) { childHeight = Math.Max(0, finalSize.Height - (top + bottom)); } var childX = 0.0; var childY = 0.0; if (!Double.IsNaN(left)) { childX = left; } if (!Double.IsNaN(top)) { childY = top; } if (!Double.IsNaN(right)) { childX = finalSize.Width - (right + childWidth); } if (!Double.IsNaN(bottom)) { childY = finalSize.Height - (bottom + childHeight); } child.Arrange(new RectangleD(childX, childY, childWidth, childHeight)); } return(finalSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { UpdateTextLayoutResult(finalSize); return base.ArrangeOverride(finalSize, options); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { DigestDataBoundContentProperties(); var content = Content; var contentElement = content as UIElement; if (contentElement != null) { var contentElementRect = new RectangleD(0, 0, finalSize.Width, finalSize.Height); contentElement.Arrange(contentElementRect, options); return finalSize; } else { if (textParserResult != null && textParserResult.Count > 0) { UpdateTextLayoutCache(finalSize); return finalSize; } } return Size2D.Zero; }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { nonLogicalAdornerDecorator.Arrange(new RectangleD(Point2D.Zero, finalSize), options); return(nonLogicalAdornerDecorator.RenderSize); }
/// <inheritdoc/> protected override Size2D ArrangeOverride(Size2D finalSize, ArrangeOptions options) { if (componentRoot == null) { var finalWidth = Double.IsPositiveInfinity(finalSize.Width) ? 0 : finalSize.Width; var finalHeight = Double.IsPositiveInfinity(finalSize.Height) ? 0 : finalSize.Height; return new Size2D(finalWidth, finalHeight); } var finalRect = new RectangleD(Point2D.Zero, finalSize); componentRoot.Arrange(finalRect, options); return componentRoot.RenderSize; }