I've an issue, which probably is very easy to solve, but I have no idea how to do it. I want to have a StackLayout element (100x100), so that its top border would be at 30% of a page.
I wrote this XAML:
<?xml version="1.0" encoding="utf-8" ?>
<AbsoluteLayout> <StackLayout AbsoluteLayout.LayoutBounds="0.5,0.3,100,100" AbsoluteLayout.LayoutFlags="PositionProportional" BackgroundColor="Yellow"> </StackLayout> </AbsoluteLayout> </ContentPage>
Unfortunately, my StackLayout is drawn at about 28% from the top of the page. What's the reason for that?
To be honest, I don't really understand how positioning in AbsoluteLayout works.
If I set AbsoluteLayout.LayoutBounds="0,0.3,100,100" AbsoluteLayout.LayoutFlags="PositionProportional" my StackLayout is drawn on the left (the left border of it is in contact with the left side of the page).
If I set AbsoluteLayout.LayoutBounds="1,0.3,100,100" AbsoluteLayout.LayoutFlags="PositionProportional" my StackLayout is drawn on the right (the right border of it is in contact with the right side of the page). And that's weird - I thought it would be drawn outside of the screen.
Which point of the element is the one that we set the position for? In other words: When I set X position of a StackLayout to be 0.3 (PositionProportional), which point of this StackLayout should be positioned at 0.3 - is it the top-left corner? Or maybe the centre of the StackLayout? I can't figure it out.
I hope you understand my issue and can help me.