Amy
Amy
CC#
Created by Amy on 8/16/2023 in #help
❔ Maui Alignment Within HorizontalStackLayout
Simply put, I'm currently attempting to create a kind of header/navbar for my Maui app. However, I am running into an issue where I cannot seem to have an ImageButton left-aligned in this bar, whilst having two Labels right-aligned.
<HorizontalStackLayout HorizontalOptions="Fill" Grid.Row="0">
<ImageButton WidthRequest="50" Aspect="AspectFit" HorizontalOptions="Start" />
<Button Text="&#x1F50D;" HorizontalOptions="End" />
<Button Text="&#x2699;" HorizontalOptions="End" />
</HorizontalStackLayout>
<HorizontalStackLayout HorizontalOptions="Fill" Grid.Row="0">
<ImageButton WidthRequest="50" Aspect="AspectFit" HorizontalOptions="Start" />
<Button Text="&#x1F50D;" HorizontalOptions="End" />
<Button Text="&#x2699;" HorizontalOptions="End" />
</HorizontalStackLayout>
I saw something in the docs about HorizontalOptions being ignored if two layouts are nested in the same direction? This is currently nested in a GridLayout, but I'm not sure that is relevant. I would be vastly appreciative if someone could direct me in how to have those two labels move right. (I have tried putting the labels inside another HorizontalStackLayout, and aligning just that, but it didn't work either, so I am presently unsure if this works at all...) Thanks for any light you can shed, - Blake
9 replies