Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Image Source always picking image from cache.

amitranjanamitranjan Member ✭✭

Hi , I am using Image control in Xamarin forms android app. Used at two places one on hamburger slider and another on a content page. i am resolving image from webapi and using the code below:
private void OnPresentedChanged(object sender, EventArgs e)

            ImgProfile.Source = new UriImageSource()
                Uri = new Uri(Constants.ProfilePicUrl),
                CachingEnabled = true,
                CacheValidity = new TimeSpan(5,0,0,0)

I tried aove code with both the conditions CachingEnabled = true/false . Here is what I observed:

  1. CachingEnabled = False : Each time the image control flickers and reloads the image. I can see a time gap of second or two between image reload from web url. Similary in the slider menu.
  2. CachingEnabled = true: My image control keeps on displaying the cached version even if the url has newer/different image, as its profile page and user can change his/her profile image N times a day.

So #1 solves my problem but the flickering part is annoying. Also please note , profile image is taken and uploaded from camera so there no way of uploading a customized image with lesser size to eliminate the delay..

I hope , my problem is clear to you guys.


Sign In or Register to comment.