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
22.21k stars 1.75k forks source link

VerticalOptions and HorizontalOptions doesn't applied to the respective Layout #25658

Open Abinaya-SF4661 opened 4 days ago

Abinaya-SF4661 commented 4 days ago

Description

I created a CustomLayout which inherits Layout. I created a CustomView class which inherits CustomLayout and added the Label control as child. I wrapped this CustomView in VerticalStackLayout and set the CustomView's VerticalOptions as FillAndExpand.

Usually when we set the VerticalOptions as FillAndExpand, the height of the Content should be finite value. But in this issue, height value came as infinity. This issue occurs in HorizontalStackLayout and AbsoluteLayout as well. This issue did not come in .NET 8 before. But now, it occurs in both .NET 8 and .NET 9.

The attached sample application is in .NET 9.

Steps to Reproduce

Run the attached application

Expected Outcome - based on the VerticalOptions, the layout's children should be displayed Actual Outcome - layout's children is displayed in the starting position for all VerticalOptions.

CustomSample.zip

Link to public reproduction project repository

No response

Version with bug

9.0.0-rc.2.24503.2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.90 SR9

Affected platforms

Windows, Android, macOS, iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

ninachen03 commented 4 days ago

This issue has been verified using Visual Studio 17.12.0 Preview 5(9.0.0-rc.2.24503.2 & 8.0.92 & 8.0.3). Can repro this issue.