I'm making a basic Android master/detail app in VS 2019, which was started with the "Blank" mobile template.
I'm just using a grid for the layout. I have the ListView in a frame, which is in a row of the grid. The ItemsSource of the ListView is bound to a generic List:
List<MyObject>
The MyObject class has a Name property. The ListView contains a simple Label in its ViewCell/DataTemplate/ItemTemplate. The Text of the Label is bound to the Name property of the MyObject class.
The problem is that some of the strings displayed are cutoff. Which strings are cutoff seems random. When I tap a row, a Details page is displayed for the item in the tapped row. When I do that and then hit Back, some of the strings that were cutoff are now fully displayed, while other entries either remain cutoff and/or there are entries that were not cutoff, but are now cutoff.
The pic at the link below shows 2 screen shots. The one on the left is before opening the Details page, and the other is after returning from the Details page:
2 screen shots; left is before Details page displayed, the right after
I'm fairly new to Xamarin Forms, so I'm probably missing something basic. The randomness of which entries are cutoff really has me puzzled. Any help would be appreciated.
Here's the XAML for the Frame and ListView:
<!-- items list -->
<Frame x:Name="ListFrame"
Grid.Row="3"
VerticalOptions="Fill"
HorizontalOptions="Fill"
OutlineColor="Black"
Padding="5"
Margin="4"
>
<ListView x:Name="ItemsListView"
ItemsSource="{Binding Items}"
SelectedItem="{Binding SelectedCryptoItem}"
IsRefreshing="{Binding IsRefreshingList}"
RefreshCommand="{Binding RefreshListCommand}"
ItemSelected="OnItemSelected"
CachingStrategy="RecycleElement"
VerticalScrollBarVisibility="Always"
RowHeight="24"
IsPullToRefreshEnabled="True"
>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding Name}"
LineBreakMode="NoWrap"
FontSize="Medium"
FontAttributes="Bold"
HorizontalOptions="StartAndExpand"
VerticalOptions="CenterAndExpand"
/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Frame>
BackgroundColor="Red"
forLable
, then share the screenshot here. I will check that. – Junior Jiang