Grid.RowDefinitions Height property not working with fixed value nor Auto in Xamarin.Forms

913 views Asked by At

It just won't happen. Here's the code (should someone notice, yeah, I posted almost the same code with a different problem a few hours ago, today is just not my day):

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:MovieDbApp.UI"
         x:Class="MovieDbApp.View.MoviesPage">
    <ContentPage.Content>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <ListView x:Name="listView" Grid.Row="0">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout VerticalOptions="FillAndExpand">
                                <Label Text="{Binding Title}"/>
                                <Image Source="{Binding PosterPath}" />
                                <Label Text="{Binding ReleaseDate}" />
                                <Label Text="{Binding DisplayGenre}" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Grid>
    </ContentPage.Content>
</ContentPage>

In StackLayout I've tried changing VerticalOptions to StartAndExpand, FillAndExpand, Fill and even EndAndExpand, but the row will always have the same height.

Out of spite, I removed VerticalOptions from StackLayout and set row height to 5000 but nope, it is still the same:

enter image description here

Running on Android emulator. No idea of what else to do.

1

There are 1 answers

2
TaylorD On BEST ANSWER

Try setting HasUnevenRows="True" on the ListView or set the RowHeight property to some value. Without setting either of those two values, the ListView uses the default RowHeight for each cell.