Reputation: 109
If I simply modify the ListView's data without scrolling, everything displays correctly:
https://gfycat.com/illustriousnastyconey
However, if I scroll before changing the data, everything looks broken after the data changes:
https://gfycat.com/abandonedvelvetyaoudad
Here is my ListView XAML
<ListView ItemsSource="{Binding network.Predictions}" x:Name="ShowsList" IsGroupingEnabled="True" HasUnevenRows="True" ItemTapped="ShowsList_ItemTapped">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell Height="25">
<Grid BackgroundColor="#CC778899">
<Label Text="{Binding Category}" FontSize="Small" TextColor="White" VerticalOptions="Center" Margin="5,0,0,0"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Text="{Binding Name}" FontSize="Medium" Margin="5"/>
<Label Grid.Column="1" Text="{Binding Status}" FontSize="Small" TextColor="{Binding StatusIndex, Converter={StaticResource StatusColor}}" Margin="5" VerticalOptions="Center/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Also, after this happens, if I scroll so that the messed up elements go off screen, and then scroll back, those elements appear just fine. It does appear to be allocating the space correctly, and they appear correctly after scrolling, so it's not reading the data incorrectly or anything like that, it's just not displaying correctly.
I had an idea and changed the background color of the listview to red to see if maybe the text was rendering as white, but nope, those missing elements are fully transparent. The correct elements all have a background color, but the missing elements just showed as red.
Upvotes: 1
Views: 786
Reputation: 14981
it seems to be a bug of listview ,this problem existed in initial versions of 3.6 and a fix was put into 3.6.0.344457,many developers experience this problem,If you have a similar question, check it out:https://github.com/xamarin/Xamarin.Forms/pull/6390 and the quickest and easiest work around to fix it is rolling Xamarin.Forms version back
Upvotes: 1