dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.72k forks source link

AbsoluteLayout has slightly different behavior in Maui (than in Forms) #17673

Open mattleibow opened 11 months ago

mattleibow commented 11 months ago

Description

I was porting this code: https://github.com/xamarin/Xamarin.Forms/blob/2d1b9b930f35b995c75d6e3823f8010f90edf877/Xamarin.Forms.Controls/ViewContainers/LayeredViewContainer.cs#L5-L39

And I ended up with:

var bottom = new Button { Text = "Bottom Button" };
var top = new Button { Text = "Click Me!", InputTransparent = false };
var grid = new AbsoluteLayout { bottom, top };
AbsoluteLayout.SetLayoutFlags(bottom, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(bottom, new Rect(0, 0, 1, 1));
AbsoluteLayout.SetLayoutBounds(top, new Rect(0, 0, 1, 1));
AbsoluteLayout.SetLayoutFlags(top, AbsoluteLayoutFlags.All);

In Forms it appears that the AbsoluteLayout does not shrink beyond the size of the children, but in maui the height goes all the way down to 1.

Steps to Reproduce

  1. TODO

Link to public reproduction project repository

N/A

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)

Affected platform versions

No response

Did you find any workaround?

Use a Grid or set the AbsoluteLayout.HeightRequest to something that is nice - like 40.

Relevant log output

No response

mattleibow commented 11 months ago

If this repo/issue is not helpful, let me know and I can try get a standalone repro. hides

ghost commented 9 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.