[NET10] Make VisualElement.ComputeConstraintForView and LayoutConstraint enum public#29703
Conversation
Contributor
There was a problem hiding this comment.
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
previously approved these changes
May 29, 2025
rmarinho
approved these changes
May 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR enhances MAUI's custom layout capabilities by refining constraint handling for child elements. Specifically:
ComputeConstraintForViewprotected virtual, allowing custom layouts to override it if needed.LayoutConstraintto public, so developers can better manage layout constraints when measuring child elements.These adjustments will help reduce unnecessary layout passes.
Issues Fixed
Fixes #28897