问题
I have a ListView in which I'm displaying the same image (chevron_right.png) in each of the rows.
On load, none of the images show.
However, when I navigate away from that page via Navigation.PushAsync() and then return back to the original page via Navigation.PopAsync(), the images display as they should.
Simplified version of my code:
<ListView x:Name="MyList">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Label Text="Hello">
<Image Source="chevron_right.png" HeightRequest="30" WidthRequest="10">
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
This is occurring on Universal Windows Platform. Any help/incites/suggestions would be greatly appreciated. Thanks!
回答1:
This is a logged bug (https://bugzilla.xamarin.com/show_bug.cgi?id=36097).
version 1.5.2.6469-pre1 is the last version where the issue does not occur.
Workaround that was functional for my purposes:
Place Image into a <Grid> and set the ColumnDefinition Width = "Auto" for the column that is containing said Image.
Hope this gets fixed soon!
来源:https://stackoverflow.com/questions/37284247/xamarin-forms-listview-images-sometimes-displays-sometimes-doesnt-uwp