My XAML was this
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="XamarinDev.BlogPage"> <ListView ItemsSource="{Binding BlogPosts}" > <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Padding="15,0" HorizontalOptions="Fill" VerticalOptions="StartAndExpand" > <Label Text="{Binding Title}" FontAttributes="Bold" LineBreakMode="WordWrap"/> <Label Text="{Binding Description}" LineBreakMode="WordWrap"></Label> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>
And it looked like this
After I added HasUnevenRows="True"
to the listview I got much better results
<ListView ItemsSource="{Binding BlogPosts}" HasUnevenRows="True"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Padding="15,0" HorizontalOptions="Fill" VerticalOptions="StartAndExpand" > <Label Text="{Binding Title}" FontAttributes="Bold" LineBreakMode="WordWrap"/> <Label Text="{Binding Description}" LineBreakMode="WordWrap"></Label> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>
No comments:
Post a Comment