Open janne-hmp opened 5 months ago
Need additional testing
I read the specifications a bit more, and it seems that EndAndExpand may be limited to StackLayouts only. So how is then the Xamarin behavior of HorizontalOptions="End" WidthRequest="200"
supposed to be done in MAUI?
Verified this issue with Visual Studio 17.10.0 Preview 3 ( 8.0.20). 17.10.0 Preview 4(9.0.0-preview.3.10457) I can repro it.
Description
I'm upgrading my app from Xamarin to MAUI. There seems to be a change in the behavior of WidthRequest that the control is always of the requested size regardless of the container boundaries. However, I need to make a button that is horizontally aligned End, is 200 wide, no smaller or bigger, but honors container boundaries, if there is less space.
In Xamarin, I could just use
HorizontalOptions="End" WidthRequest="200"
. In MAUI, I apparently cannot use WidthRequest, because it does not honor the container boundaries. If I useHorizontalOptions="Fill" MaximumWidthRequest="200"
the control is not horizontally End aligned. If I use eitherHorizontalOptions="End" MaximumWidthRequest="200"
orHorizontalOptions="EndAndExpand" MaximumWidthRequest="200"
, the button is of as small size as it can get, rather than 200.I believe that
HorizontalOptions="EndAndExpand" MaximumWidthRequest="200"
should expand the button to cover the available space, making the button 200 wide when there is enough space. But it works just the same asHorizontalOptions="End" MaximumWidthRequest="200"
IfEndAndExpand
is supposed to work only for StackLayouts, then how is the Xamarin resizing behavior ofHorizontalOptions="End" WidthRequest="200"
supposed to be done in MAUI?Steps to Reproduce
Add a grid on the top of the existing UI components and a button with
HorizontalOptions="EndAndExpand" MaximumWidthRequest="200"
inside the grid. The code is then:Link to public reproduction project repository
No response
Version with bug
9.0.0-preview.1.9973
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 14, didn't test the other platforms
Did you find any workaround?
No, it seems impossible to make buttons that have the same layout behavior as
HorizontalOptions="End" WidthRequest="200"
had in Xamarin.Relevant log output
No response