I'm making an application in Xamarin forms but I have some trouble sticking a layout to the bottom of the device. I thought an AbsoluteLayout would work, but I cannot grasp how it works. So I made a RelativeLayout which I filled with the elements I wanted to fill but now I cannot seem to get it working on sticking to the bottom of the device at all time.
Below is a screenshot to make things hopefully a little bit more clear. I have a stacklayout which I fill with the headerlayout and the contentlayout. But if I just add the footerlayout to the stacklayout, it will not be sticked to the bottom of the page but (logically) just behind the previous child. Now I think an Absolutelayout would do the trick, but I cannot seem to grasp the functionality and the Layoutflags and bounds of it. Could someone help me out?
An AbsoluteLayout is used to position and size children using explicit values. The position is specified by the upper-left corner of the child relative to the upper-left corner of the AbsoluteLayout , in device-independent units. AbsoluteLayout also implements a proportional positioning and sizing feature.
The only way the code behind can interact with a View Model is through binding the View Model to the view. So ViewModel MyViewModel = new ViewModel; this set up the view to know about the View Model.
<StackLayout> <StackLayout Orientation="Horizontal" VerticalOptions="Start"> <!-- top controls --> </StackLayout> <StackLayout VerticalOptions="CenterAndExpand"> <!-- middle controls --> </StackLayout> <StackLayout Orientation="Horizontal" VerticalOptions="End"> <!-- bottom controls --> </StackLayout> </StackLayout>
Make sure to have no more than one child with Expand
options for best performance.
You can use VerticalOptions to send layout to bottom.
var stacklayout = new stackLayout() { VerticalOptions = LayoutOptions.EndAndExpand Children = { //your elements } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With