Creating a button in MAUI that is horizontally End aligned, certain width, and honors container boundaries #21582
janne-hmp
started this conversation in
Upgrading from Xamarin
Replies: 3 comments 2 replies
-
Try this: HorizontalOptions="EndAndExpand" and remove WidthRequest="200". Also keep MaximumWidthRequest="200". |
Beta Was this translation helpful? Give feedback.
0 replies
-
Unfortunately, it does not work. It functions just the same as End. Only Fill fills the available space. Should this work according to XAML specification? If so, should I report it as a bug? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Here's the default .NET MAUI 9.0 Preview 2 project with a grid with a button:
The result is: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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. What is the way to do the above in MAUI? If I useHorizontalOptions="Fill" MaximumWidthRequest="200"
the control is not horizontally End aligned. If I don't use Fill, the button is of as small size as it can get, rather than 200.Beta Was this translation helpful? Give feedback.
All reactions