I encountered a problem with XAML Layout creation.
My XAML code is the following:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Achievement_Up.Achievements"
Title="Achievements">
<ScrollView Margin="20">
<FlexLayout Wrap="Wrap"
Direction="Row"
AlignContent="Start">
<BoxView Color="black"
HeightRequest="100"
WidthRequest="100"/>
<BoxView Color="Green"
HeightRequest="100"
WidthRequest="100"/>
</FlexLayout>
</ScrollView>
</ContentPage>
My debug output, on the contrary of my expectations, is the following:
Can anybody clarify for me how these tags works? I don't really know what am I doing wrong.
Lastly, there's no c# code behind the xaml page.
EDIT
I would like to see my two boxes on the top left corner in a row, instead of seeing them in the center/left side of the ScrollView. Knowing how to handle tags likes ScrollView or FlexLayour works could help me get better at developing .NET MAUI applications.
AlignItems
instead of AlignContents
.ScrollView
is getting centered in the ContentPage. Try setting ScrollView's VerticalOptions="Start"
. OR if you remove ScrollView, set VerticalOptions on the FlexLayout.