So I have the standard TapGestureRecognizer nested within an Image view and the point is that after tapping that button it changes its source color. Here is the thing; I'm noticing that the transition is very slow or after that initial tap, at least few seconds pass between the button transition.
Is caching the image solution or what technique could I use to make it an instant occurrence ?
Thanks
Answers
Can you share this part of code? I change the
Image
andImageView
's background color, both of them are changed quickly. Here is running GIF.Here is code.
If you set your source from Uri by
UriImageSource
,UriImageSource
have a property calledCachingEnabled = false
.https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=windows#downloaded-image-caching
I'm working with the local png icon images and how can I cache these ?
XAML:
Code behind:
This is the speed demonstrated through another app that I'm after
What is that Task.Delay? Did you try without it?
Hey, it's nothing, the same had been without these.
In the gif above the red heart appears almost immediately upon the tap/click whereas my implementation adds 1-2 seconds
of delay, that is without those Task.Delay statements.
I test your code in my demo, it could running normally, here is running gif.
I notice you used
async
inButtonFavouriteToggle_Clicked
, do you have some logic code? After the logic code, then you can getSelectedLocation.VM.IsFavourite
state?If u used a static flag like me, if this issue will disappear.
I'm toggling the favorite variable from the ViewModel with
if (SelectedLocation.VM.IsFavourite)
that's it, but it's still the same slowness. Can it be that the VM retrieval adds the latency to the responsiveness?
It seems not, in your GIF, when you click the Image, then screen is grey, show a loading(pink three dots). Can you try to remove this part of code, then make a test.
Hey no you got that wrong, that's not my app - it was just a test on another commercial app in how rapidly it can respond to the tap. That's how I would like my app to tap-respond. Thanks anyways for the effort.
Can you share a demo that could reproduce this issue?
I can show you a gif of my issue, however I'll send you a reminder on the pm since I'm away at the moment; thanks again.
Ok, watting for your update.