Reputation: 169
I am trying to hook an ImageUrl
property to MvxImageView
, to implement my own image caching service.
I have tried using a PropertyConverter
that gets the value, but I don't receive a response.
Then, I tried my own implementation for IMvxImageHelper
, but I get an unusual behaviour because I using a list with images, all images containers get the same picture and when I swipe the list, the picture changes in all MvxImageView
widgets.
This implementation is in a Setup file in CreateApp
method using a RegisterSingleton
.
What is the correct way to hook into the process of caching images?
Upvotes: 0
Views: 268
Reputation: 66882
If you want to replace the entire download and caching chain then the easiest interface to provide is IMvxImageHelper<Bitmap>
- it's expected that this is registered as Mvx.RegisterType
- so that each image view will get a new helper object.
If you want to replace just parts of the download and caching, then you can instead provide implementations of:
IMvxHttpFileDownloader
IMvxImageCache<Bitmap>
IMvxLocalFileImageLoader<Bitmap>
There's no documentation available for these - but these api's are very small and the source code is available as a reference.
Then, I tried my own implementation for IMvxImageHelper, but I get an unusual behaviour because I using a list with images, all images containers get the same picture and when I swipe the list, the picture changes in all MvxImageView widgets.
I would guess you had a bug in your image helper implementation or in it's registration with IOC.
One other alternative you can consider is implementing your own custom ImageView
class with its own ImageUrl
property - you don't have to use MvxImageView
Upvotes: 1