Chris Fodor
Chris Fodor

Reputation: 117

Xamarin Forms Image source from URL gets cached?

I have some images on my FTP server which I want to display, my code in XAML is:

 <Image x:Name="sponsor1" Source="http://website.com/web/image1.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="CenterAndExpand"/>

I recently changed the images on my FTP server, but my app (connected through USB and the app is ran by the IDE) is still displaying the old images that are no longer there.

Why is it doing it? is it caching? How do I disable it?

Upvotes: 1

Views: 1286

Answers (1)

Jason
Jason

Reputation: 89082

Yes, caching is enabled by default. To disable, set CachingEnabled="false"

<Image 
    HorizontalOptions="CenterAndExpand"
    VerticalOptions ="CenterAndExpand">
    <Image.Source>
        <UriImageSource Uri="{Binding Image}" 
            CacheValidity="14" 
            CachingEnabled="true"/>
    </Image.Source>
</Image>

Upvotes: 3

Related Questions