From 37f5f50212cce6d4ee61d10f20cc6fcc309d1c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Mon, 13 Feb 2023 22:41:41 +0100 Subject: [PATCH 1/2] Update Layoutable.cs --- src/Avalonia.Base/Layout/Layoutable.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Layout/Layoutable.cs b/src/Avalonia.Base/Layout/Layoutable.cs index 775b8adddd..f14ad3058a 100644 --- a/src/Avalonia.Base/Layout/Layoutable.cs +++ b/src/Avalonia.Base/Layout/Layoutable.cs @@ -323,12 +323,15 @@ namespace Avalonia.Layout set { SetValue(UseLayoutRoundingProperty, value); } } - internal Size? PreviousMeasure => _previousMeasure; + /// + /// Gets the available size passed in the previous layout pass, if any. + /// + public Size? PreviousMeasure => _previousMeasure; /// /// Gets the layout rect passed in the previous layout pass, if any. /// - internal Rect? PreviousArrange => _previousArrange; + public Rect? PreviousArrange => _previousArrange; /// /// Creates the visual children of the control, if necessary From 81f6f65c263a5e6fa27c9df3ef75c0515762818d Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 16 Feb 2023 11:34:37 +0100 Subject: [PATCH 2/2] Implement LayoutInformation. --- src/Avalonia.Base/Layout/LayoutInformation.cs | 27 +++++++++++++++++++ src/Avalonia.Base/Layout/Layoutable.cs | 4 +-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/Avalonia.Base/Layout/LayoutInformation.cs diff --git a/src/Avalonia.Base/Layout/LayoutInformation.cs b/src/Avalonia.Base/Layout/LayoutInformation.cs new file mode 100644 index 0000000000..9b821053a2 --- /dev/null +++ b/src/Avalonia.Base/Layout/LayoutInformation.cs @@ -0,0 +1,27 @@ +namespace Avalonia.Layout; + +/// +/// Provides access to layout information of a control. +/// +public static class LayoutInformation +{ + /// + /// Gets the available size constraint passed in the previous layout pass. + /// + /// The control. + /// Previous control measure constraint, if any. + public static Size? GetPreviousMeasureConstraint(Layoutable control) + { + return control.PreviousMeasure; + } + + /// + /// Gets the control bounds used in the previous layout arrange pass. + /// + /// The control. + /// Previous control arrange bounds, if any. + public static Rect? GetPreviousArrangeBounds(Layoutable control) + { + return control.PreviousArrange; + } +} diff --git a/src/Avalonia.Base/Layout/Layoutable.cs b/src/Avalonia.Base/Layout/Layoutable.cs index f14ad3058a..4a273b0291 100644 --- a/src/Avalonia.Base/Layout/Layoutable.cs +++ b/src/Avalonia.Base/Layout/Layoutable.cs @@ -326,12 +326,12 @@ namespace Avalonia.Layout /// /// Gets the available size passed in the previous layout pass, if any. /// - public Size? PreviousMeasure => _previousMeasure; + internal Size? PreviousMeasure => _previousMeasure; /// /// Gets the layout rect passed in the previous layout pass, if any. /// - public Rect? PreviousArrange => _previousArrange; + internal Rect? PreviousArrange => _previousArrange; /// /// Creates the visual children of the control, if necessary