How to add a handler to an image and run it after image loaded? Thanks!
From Uno code you can subscribe to the ImageSource.Changed
event to be informed of changes in its State
.
Thank you for reply.
I tried to subscribe to the event and it can really inform me about the State changes. However, when I tried to get the image height and width after state changes (pending -> ready), it still give me 0,0 immediately. Then I try to solve it with a timer, it worked but sometimes failed if too many images are loaded at same time or other reasons idk.
It shows the problem that:
- Although state is changed, the image are not fully loaded at the same time actually.
- Despite I added the timer, I still can’t get the correct size sometimes.
You might concern that why don’t I just preload the images as what you told me in the other post. This is because I found difficulty to preload a bundle of images and it seems not work despite preloaded.
Thank you for help a lot!