Skip to content

Commit

Permalink
Call correct Arrange logic from VE.Arrange (#23997)
Browse files Browse the repository at this point in the history
* Call correct Arrange logic from VE.Arrange

* - update comments

* - add more comments

* - add more comments
  • Loading branch information
PureWeen authored Aug 5, 2024
1 parent 20e456e commit d387de8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Controls/src/Core/VisualElement/VisualElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,11 +1191,8 @@ public Size Measure(double widthConstraint, double heightConstraint)
/// <param name="flags">A value that controls whether margins are included in the returned size.</param>
/// <returns>The minimum size that an element needs in order to be displayed on the device.</returns>
/// <remarks>If the minimum size that the element needs in order to be displayed on the device is larger than can be accommodated by <paramref name="widthConstraint" /> and <paramref name="heightConstraint" />, the return value may represent a rectangle that is larger in either one or both of those parameters.</remarks>
#pragma warning disable RS0016 // Add public types and members to the declared API

[Obsolete("Use Measure with no flags.")]
public virtual SizeRequest Measure(double widthConstraint, double heightConstraint, MeasureFlags flags = MeasureFlags.None)
#pragma warning restore RS0016 // Add public types and members to the declared API
{
bool includeMargins = (flags & MeasureFlags.IncludeMargins) != 0;
Thickness margin = default(Thickness);
Expand Down Expand Up @@ -1734,6 +1731,7 @@ void UpdateBoundsComponents(Rect bounds)
/// <summary>
/// Gets or sets the frame this element resides in on screen.
/// </summary>
/// <remarks>Setting this property outside of <see cref="ArrangeOverride"/> won't do anything. If you want to influence this property you'll need to override <see cref="ArrangeOverride"/></remarks>
public Rect Frame
{
get => _frame;
Expand Down Expand Up @@ -1838,10 +1836,13 @@ public int ZIndex
/// Positions child objects and determines a size for an element.
/// </summary>
/// <param name="bounds">The final size that the parent computes for the child in layout, provided as a <see cref="Rect"/> value.</param>
/// <remarks>Parent objects that implement custom layout for their child elements should call this method from their layout override implementations to form a recursive layout update.</remarks>
/// <remarks>
/// Parent objects that implement custom layout for their child elements should call this method from their layout override implementations to form a recursive layout update.
/// Prior to .NET 9, this method simply called <see cref="Layout"/>. If you need to revert to the old behavior, just call <see cref="Layout"/>.
/// </remarks>
public void Arrange(Rect bounds)
{
Layout(bounds);
ArrangeOverride(bounds);
}

/// <inheritdoc/>
Expand All @@ -1851,11 +1852,11 @@ Size IView.Arrange(Rect bounds)
}

/// <summary>
/// Allows subclasses to override <see cref="Arrange(Rect)"/> even though
/// the interface has to be explicitly implemented to avoid conflict with the old <see cref="Arrange(Rect)"/> method.
/// Allows subclasses to implement custom Arrange logic during a controls layout pass.
/// </summary>
/// <param name="bounds">The new bounds of the element.</param>
/// <returns>The resulting size of this element's frame by the platform.</returns>
/// <remarks>Subclasses will stil want to call <see cref="ArrangeOverride"/> on the base class or call <see cref="IViewHandler.PlatformArrange"/> on the <see cref="Handler"/> .</remarks>
protected virtual Size ArrangeOverride(Rect bounds)
{
Frame = this.ComputeFrame(bounds);
Expand Down Expand Up @@ -1898,8 +1899,7 @@ Size IView.Measure(double widthConstraint, double heightConstraint)
}

/// <summary>
/// Provides a way to allow subclasses to override <see cref="Measure(double, double)"/> even though
/// the interface has to be explicitly implemented to avoid conflict with the old Measure method.
/// Allows subclasses to implement custom Measure logic during a controls measure pass.
/// </summary>
/// <param name="widthConstraint">The width constraint to request.</param>
/// <param name="heightConstraint">The height constraint to request.</param>
Expand Down

0 comments on commit d387de8

Please sign in to comment.