Skip to content

Further remove dependency of Compatibility.Layout on all modern .NET MAUI controls#29281

Closed
jfversluis wants to merge 14 commits intonet10.0from
remove-compat-layout-net10
Closed

Further remove dependency of Compatibility.Layout on all modern .NET MAUI controls#29281
jfversluis wants to merge 14 commits intonet10.0from
remove-compat-layout-net10

Conversation

@jfversluis
Copy link
Member

@jfversluis jfversluis commented May 1, 2025

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

Ideally we will eventually be able to remove Compatibility.Layout but we are still in a state where if users have overridden certain methods or are calling some properties that are still on Compatibility.Layout then the binary isn't compatible. This PR copies all of the public APIs to the subclasses so whenever users override or call those methods/properties on the base class the IL will resolved to the derived type vs the Compatibility.Layout

We have also implemented a property that will detect if the Compatibility.Layout is being used with any of our modern layouts. If it is then we just bypass all of the Compatibility.Layout logic so that it doesn't interfere with performance or the MAUI logic

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
@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
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\Bugzilla\Bugzilla36788.cs(68,5): error CS0117: 'ContentView' does not contain a definition for 'IsClippedToBounds' [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
C:\a\_work\1\s\src\Compatibility\Core\src\Windows\RadioButtonRenderer.cs(59,35): error CS0117: 'RadioButton' does not contain a definition for 'PaddingProperty' [C:\a\_work\1\s\src\Compatibility\Core\src\Compatibility.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Compatibility\Core\src\Windows\RadioButtonRenderer.cs(59,97): error CS0117: 'RadioButton' does not contain a definition for 'PaddingProperty' [C:\a\_work\1\s\src\Compatibility\Core\src\Compatibility.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Compatibility\Core\src\Windows\RadioButtonRenderer.cs(112,43): error CS0117: 'RadioButton' does not contain a definition for 'PaddingProperty' [C:\a\_work\1\s\src\Compatibility\Core\src\Compatibility.csproj::TargetFramework=net10.0-windows10.0.20348.0]
    33 Error(s)

@PureWeen PureWeen force-pushed the remove-compat-layout-net10 branch from a3468ba to 985ff86 Compare June 10, 2025 21:27
@PureWeen PureWeen requested a review from mattleibow June 10, 2025 22:16
@PureWeen
Copy link
Member

I did a basic test with the nuget from this PR against MCT version 12.0

I was still able to use the SemanticOrderView which inherits from ContentView and it didn't crash or throw any exceptions.

/// <summary>The children contained in this layout.</summary>
/// <remarks>For internal use only. This API can be changed or removed without notice at any time.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public IReadOnlyList<Element> Children => LogicalChildrenInternal;
Copy link
Contributor

@MartyIX MartyIX Jun 11, 2025

Choose a reason for hiding this comment

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

Isn't it a good opportunity to enable #nullable for modified properties? It's always so frustrating to guess if something can or cannot be null.

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

A quick toilet review 😉

@PureWeen PureWeen force-pushed the remove-compat-layout-net10 branch from bc05887 to a5780b2 Compare June 11, 2025 17:28
@PureWeen PureWeen force-pushed the remove-compat-layout-net10 branch 2 times, most recently from fa29135 to 58b2dd0 Compare June 23, 2025 22:15
@PureWeen PureWeen changed the title Remove Compatibility.Layout as a subclass of all modern .NET MAUI controls Further remove dependency of Compatibility.Layout on all modern .NET MAUI controls Jun 23, 2025
@PureWeen PureWeen marked this pull request as ready for review June 25, 2025 01:55
@PureWeen PureWeen requested a review from a team as a code owner June 25, 2025 01:55
@PureWeen PureWeen requested review from PureWeen and removed request for albyrock87 June 25, 2025 01:55
@PureWeen
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the remove-compat-layout-net10 branch from f143719 to 647926d Compare July 13, 2025 22:55
@PureWeen PureWeen force-pushed the remove-compat-layout-net10 branch 2 times, most recently from 0f2420c to 53fb5cf Compare July 17, 2025 04:13
Copilot AI added a commit that referenced this pull request Jul 17, 2025
…d modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
PureWeen added a commit that referenced this pull request Jul 17, 2025
…d modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
PureWeen added 14 commits July 16, 2025 23:42
# Conflicts:
#	src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt
@PureWeen PureWeen force-pushed the remove-compat-layout-net10 branch from 53fb5cf to c4439d0 Compare July 17, 2025 04:42
@PureWeen
Copy link
Member

Moved PR to here

@PureWeen PureWeen closed this Jul 17, 2025
@PureWeen PureWeen deleted the remove-compat-layout-net10 branch July 17, 2025 04:51
PureWeen added a commit that referenced this pull request Jul 17, 2025
…d modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Jul 17, 2025
…d modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

# Conflicts:
#	src/Compatibility/Core/src/iOS/Renderers/CarouselPageRenderer.cs
#	src/Controls/src/Core/Platform/Windows/FormsListView.cs
PureWeen pushed a commit that referenced this pull request Jul 17, 2025
…d modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

# Conflicts:
#	src/Compatibility/Core/src/iOS/Renderers/CarouselPageRenderer.cs
#	src/Controls/src/Core/Platform/Windows/FormsListView.cs
PureWeen added a commit that referenced this pull request Jul 18, 2025
…MAUI controls (#30672)

* Initial plan

* Copy all changes from PR #29281 - Remove CarouselPage dependencies and modernize layout system

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

# Conflicts:
#	src/Compatibility/Core/src/iOS/Renderers/CarouselPageRenderer.cs
#	src/Controls/src/Core/Platform/Windows/FormsListView.cs

* - Fix Compatibility

# Conflicts:
#	src/Controls/src/Core/ClippedToBoundsElement.cs
#	src/Controls/src/Core/ContentPresenter.cs
#	src/Controls/src/Core/IClippedToBoundsElement.cs
#	src/Controls/src/Core/InputTransparentContainerElement.cs

# Conflicts:
#	src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt
#	src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt

* Update ScrollViewHandler.Android.cs

* - fix compat tests

* - fixes based on comments

* - address comments and fix txt file

* no need for this

* - remove redundant if statements

* - fix unshipped files

* - fix windows

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 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 t/breaking 💥

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants