Xamarin Forms ListView Images Sometimes Displays, Sometimes Doesn't (UWP)

梦想的初衷 提交于 2019-12-09 23:18:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!