1
我在我的项目中使用FFImageLoading而不是Image
以获取更多高级功能,如占位符。在我的项目中,有一个需要显示的图像列表。所以我使用相同的列表视图。如何清除/避免缓存列表项目图像 - Xamain.Forms
<ListView x:Name="membersList" ItemTapped="Handle_ItemTappedMember" HorizontalOptions="FillAndExpand" HasUnevenRows="true" SeparatorVisibility="None" BackgroundColor="#EEEEEE" Grid.Row="0" Grid.Column="0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="5,5,5,5" HeightRequest="75" Margin="10,5,10,5" BackgroundColor="White" HorizontalOptions="FillAndExpand">
<ffimageloading:CachedImage Source="{Binding imageUrl}" x:Name="patImage" WidthRequest="60" HeightRequest="60" Aspect="AspectFill" VerticalOptions="Center">
<ffimageloading:CachedImage.Transformations>
<fftransformations:CircleTransformation />
</ffimageloading:CachedImage.Transformations>
</ffimageloading:CachedImage>
<StackLayout Spacing="3" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="FillAndExpand">
<Label FontAttributes="Bold" FontSize="14" TextColor="#212121" Text="{Binding FullName}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Relation}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Pat_ID}" />
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我的问题是我不想在这里使用缓存技术,因为我的服务器映像可能会更改而不更改URL。
我知道如何清除单个图像视图的缓存与FFImageLoading
await CachedImage.InvalidateCache(Image.Source, CacheType.All, true);
但如何在ListView控件来实现这一目标?我正在使用Binding属性在这里加载图像。
难道你不能只将'CacheDuration'属性设置为0或-1或其他? –
让我检查一下,已经尝试过0,但到目前为止没有运气 –
@GeraldVersluis 0&-1不能正常工作 –