1
votes

i have a simple custom tile control in Xamarin Forms and i can't get the inner alignment to work like i would it expect in MS Xaml. (on Xamarin.iOS (for iPad!))

    <ContentView.Content>

    <Grid x:Name="LayoutGrid" BindingContext="{x:Reference tile}" BackgroundColor="{Binding Color}">
        <Grid.GestureRecognizers>
            <TapGestureRecognizer Tapped="ExecuteCommandOnTapped" />
        </Grid.GestureRecognizers>

        <StackLayout HorizontalOptions="Start" VerticalOptions="End" BackgroundColor="Aqua" Orientation="Vertical">
            <Label x:Name="AdditionalDescription" Text="{Binding AdditionalText}"   TextColor="{x:Static local:AppColors.AppBackground}" VerticalOptions="End" HorizontalOptions="Start" XAlign="End" YAlign="End" Font="32" /> 
            <Label x:Name="Description"           Text="{Binding Text}"             TextColor="{x:Static local:AppColors.AppBackground}" VerticalOptions="End" HorizontalOptions="Start" XAlign="End" YAlign="End" Font="Bold, 32" />   
        </StackLayout>
    </Grid> 

</ContentView.Content>

Is there any trick to align the Inner Stacklayout to the bottom? When i use the control, the control has the expected size (fills the entire available space) but the inner stack layout is aligned to top. :(

1
Is there anybody out, that use Xamarin.Forms in production? It seems very buggy in the current state! :( - The Chris

1 Answers

0
votes

I faced similar problem with StackLayout and had to switch to Grid. With Grid I was able to exploit row/column property to position my child controls properly.

-------------------------------------------------------------Edit------------------------------------------------------------- Just now I found that alignment does work but if the layout is inside a grid then it effect is within the particular cell of the grid and not for the complete grid.

In your example - perhaps you have to give proper rowdefinition and columndefintion of the grid and position the stacklayout in a specific grid cell. And alignment of stacklayout content would be within this cell only.

A good read - http://blog.tpcware.com/2014/09/xamarin-xaml-vs-microsoft-xaml-the-devil-is-in-the-details/ . You can run the examples given in the blog and see alignment property working.