Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Do something (async) while image loads from URI.

$
0
0

I have a page with several images all sourced from URIs.

While each image is in a Image.IsLoading == true state, I'd like to show an ActivityIndicator in its place until the loading is done, but the logic is eluding me.

I'm thinking and trying things like this:

async void LoadImage()
            {
                while (Img1.IsLoading) ;//Do Nothing

        //Then when image has loaded, switch ActivityIndicator off
                activityIndicator.IsRunning = false;
                activityIndicator.IsVisible = false;
            }

but it never seems to give the result I want.

The idea of Task/async/await is all quite new to me so perhaps I'm getting it wrong.

Any advice much appreciated, thanks :)


Viewing all articles
Browse latest Browse all 204402


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>