Skip to content

Remove Compatibility.Layout as a subclass of all modern .NET MAUI controls #29281

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

Draft
wants to merge 9 commits into
base: net10.0
Choose a base branch
from

Conversation

jfversluis
Copy link
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

This PR removes Compatibility.Layout as a subclass of all modern .NET MAUI controls. It simplifies the control hierarchy and layout system by removing Compatibility.Layout from the middle of the hierarchy.

Additionally, does some minor code clean up and moving docs to inline.

Issues Fixed

Fixes #28736

@jfversluis jfversluis added t/breaking 💥 area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter labels May 1, 2025
@jfversluis jfversluis added this to the .NET 10.0-preview5 milestone May 1, 2025
Copy link
Contributor

🚨 API change(s) detected @davidbritch FYI

@jfversluis
Copy link
Member Author

@albyrock87 can't add you as a reviewer, so tagging you like this. Would be great to get your perspective here!

@jfversluis jfversluis requested a review from PureWeen May 1, 2025 19:17
jsuarezruiz
jsuarezruiz previously approved these changes May 2, 2025
@jfversluis jfversluis force-pushed the remove-compat-layout-net10 branch from c4000a5 to a3468ba Compare May 2, 2025 12:19
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we keeping this class alive?

@@ -12,7 +12,7 @@ namespace Microsoft.Maui.Controls
/// <include file="../../docs/Microsoft.Maui.Controls/RefreshView.xml" path="Type[@FullName='Microsoft.Maui.Controls.RefreshView']/Docs/*" />
[ContentProperty(nameof(Content))]
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public partial class RefreshView : ContentView, IElementConfiguration<RefreshView>, IRefreshView, ICommandElement
public partial class RefreshView : ContentView, IElementConfiguration<RefreshView>, IRefreshView, ICommandElement, IClippedToBoundsElement
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we implement IClippedToBoundsElement directly in TemplatedView so that this class gets it for free?

@@ -31,7 +28,7 @@ public Rect LayoutAreaOverride
return;
_layoutAreaOverride = value;
// Dont invalidate here, we can relayout immediately since this only impacts our innards
UpdateChildrenLayout();
InvalidateMeasure();
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this one is already obsolete in .NET9: can we remove the property completely?

[Obsolete]
public Rect LayoutAreaOverride

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter t/breaking 💥
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants