Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call correct Arrange logic from VE.Arrange #23997

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading