Skip to content

[NET10] Make VisualElement.ComputeConstraintForView and LayoutConstraint enum public#29703

Merged
rmarinho merged 8 commits intonet10.0from
fix-28897
May 30, 2025
Merged

[NET10] Make VisualElement.ComputeConstraintForView and LayoutConstraint enum public#29703
rmarinho merged 8 commits intonet10.0from
fix-28897

Conversation

@jsuarezruiz
Copy link
Contributor

Description of Change

This PR enhances MAUI's custom layout capabilities by refining constraint handling for child elements. Specifically:

  • Makes ComputeConstraintForView protected virtual, allowing custom layouts to override it if needed.
  • Changes LayoutConstraint to public, so developers can better manage layout constraints when measuring child elements.

These adjustments will help reduce unnecessary layout passes.

Issues Fixed

Fixes #28897

Copilot AI review requested due to automatic review settings May 28, 2025 07:32
@jsuarezruiz jsuarezruiz added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label May 28, 2025
@jsuarezruiz jsuarezruiz requested a review from a team as a code owner May 28, 2025 07:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines MAUI’s custom layout capabilities by adjusting constraint handling for child elements. The key changes include:

  • Changing the access modifier of ComputeConstraintForView from internal to protected virtual so that custom layouts can override it.
  • Making the LayoutConstraint enum public for enhanced layout constraint management.
  • Updating relevant PublicAPI files to expose the new public API changes.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

File Description
src/Controls/src/Core/VisualElement/VisualElement.cs Changed ComputeConstraintForView’s access modifier to protected virtual
src/Controls/src/Core/LayoutConstraint.cs Changed LayoutConstraint from internal to public
PublicAPI.Unshipped.txt (all platforms) Exposed LayoutConstraint and updated ComputeConstraintForView signature in the public API
Comments suppressed due to low confidence (2)

src/Controls/src/Core/LayoutConstraint.cs:6

  • Ensure that the public documentation in the docs folder is updated to reflect the new public access of LayoutConstraint and its intended usage.
public enum LayoutConstraint

src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt:313

  • The public API signature for ComputeConstraintForView has been updated. Please confirm that this potential breaking change is acceptable and that versioning/documentation adjustments are in place.
+~virtual Microsoft.Maui.Controls.VisualElement.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void

mattleibow
mattleibow previously approved these changes May 29, 2025
@rmarinho rmarinho merged commit 8e0bf4a into net10.0 May 30, 2025
129 checks passed
@rmarinho rmarinho deleted the fix-28897 branch May 30, 2025 10:21
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants