I've see this topic a few times but right now when I need it, I can't find it... I have a problem with a few ListView's in my app. The ListViews are displaying content from a database and from a webservice. The content of the ListView can be very large and sometimes, the text is cut off...
This is my ListView so far:
<ListView Grid.Row="1" x:Name="DataListView" ItemsSource="{Binding GroupData}" GroupShortNameBinding="{Binding ShortCategory}" CachingStrategy="RecycleElement"
IsGroupingEnabled="True" HasUnevenRows="True" BackgroundColor="#b99f65" SeparatorColor="#55492e" ItemTapped="ListView_OnItemTapped" Margin="0,3,0,0">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="#120305" Margin="0">
<StackLayout Orientation="Horizontal" VerticalOptions="Center" Margin="15,0">
<Label Text="{Binding Category}" TextColor="#b99f65" FontSize="18" FontAttributes="Bold" />
<Label Text="{Binding ShortCategory, StringFormat='({0})'}" FontSize="18" TextColor="#b99f65" />
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical" Margin="10,5" VerticalOptions="Fill">
<Label Text="{Binding Name}" FontSize="14" FontAttributes="Bold" Margin="0" />
<Label Text="{Binding Effect}" FontSize="11" LineBreakMode="WordWrap" Margin="0" />
<Label Text="{Binding Ingredients, StringFormat='Ingredients: {0}'}" FontSize="11" LineBreakMode="WordWrap" Margin="0,3,0,0" SizeChanged="OnLabelSizeChanged" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Here, the Ingredients are cut off in iOS on some device sizes. I have implemented a SizeChanged-Event for the last Label to see if the size is set correctly, and it is. This is the output:
[0:] LABEL HEIGHT CHANGED:: 26.5
[0:] LABEL HEIGHT CHANGED:: 26.5
[0:] LABEL HEIGHT CHANGED:: 13.5
[0:] LABEL HEIGHT CHANGED:: 13.5
[0:] LABEL HEIGHT CHANGED:: 26.5
[0:] LABEL HEIGHT CHANGED:: 13.5
[0:] LABEL HEIGHT CHANGED:: 26.5
[0:] LABEL HEIGHT CHANGED:: 13.5
[0:] LABEL HEIGHT CHANGED:: 26.5
[0:] LABEL HEIGHT CHANGED:: 13.5
Any of the "26.5" height labels are cut off in half. Because this only happens on iOS it must be a problem there. Can someone help me out to fix this? I have the same issue on other places of my App too and haven't found a working solution yet... I know I can set the RowHeight to the max possible value but for this I need to know how many times the text will be wraped and it is not a nice solution... I would like to use the dynamic sizing...