Don't get HorizontalOptions="End" to work in a Horisontal stacklayout

Magnus Wallon 0 Reputation points
2024-08-24T07:56:08.89+00:00

Hi,

hav many problems wit stacklayots when I'm going from xamarin to .net maui. Added an image where I cant understand why the button "X" wont be at the right side of the screen?

/magnusSkärmavbild 2024-08-24 kl. 09.51.09

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,478 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 42,351 Reputation points Microsoft Vendor
    2024-08-26T02:34:29.0733333+00:00

    Hello,

    The Maui team has answered this issue for this situation HorizontalOption End does not work on a HorizontalStackedLayout on both Android and iOS #20952. This is an expected design and not an issue.

    @czuck I'm pretty sure this is by design. Horizontal StackLayout just measures to the width of all the controls so it will ask the control what size it wants to be with infinite space. It isn't going to have empty space on the left or right. You most likely want to use a grid for this scenario.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.