I have been banging my head for a while trying to get this to work. Hopefully someone can help.
I have a number of Grids inside a ListView.
Everything looks good except the Image in the final Row.
I HAVE to use AspectFit for the Image but if I do so some images have a letterboxing problem at the bottom.
I think that the Grid Row's height is using the pre-aspect image height to size the row instead of the height after aspect is applied.
It seems exactly as per bugzilla bug https://bugzilla.xamarin.com/show_bug.cgi?id=55294
Here is a screenshot in my app:
I need a solution for Xamarin Forms, not native.
Here is my Grid xaml:
<Grid x:Name="FeedGrid" Grid.Column="1" BackgroundColor="White" VerticalOptions="Start">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" BackgroundColor="White" VerticalOptions="Start" Orientation="Horizontal">
<Label BackgroundColor="White" VerticalOptions="Start" Text="{Binding UserName}" LineBreakMode="NoWrap" Font="Bold" FontSize="Small" />
<Label BackgroundColor="White" VerticalOptions="Fill" Text="{Binding UserTag}" LineBreakMode="NoWrap" FontSize="Small" />
</StackLayout>
<Label Grid.Row="1" BackgroundColor="White" VerticalOptions="Start" Text="{Binding CreatedAt}" LineBreakMode="NoWrap" FontSize="Small" />
<Label Grid.Row="2" BackgroundColor="White" VerticalOptions="Start" Text="{Binding Content}" VerticalTextAlignment="Start" LineBreakMode="WordWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="Small" />
<Image x:Name="FeedImage" Grid.Row="3" VerticalOptions="FillAndExpand" HorizontalOptions="Center" Aspect="AspectFit" Source="{Binding ImageUrl}"></Image>
</Grid>
None of the horizontal or vertical options work.
Is it possible to get the Grid Row in code and programmatically set a HeightRequest?
Any other suggestions?
Help...