While the image is downloading, we want to show a loading text centered over the image. This is already in the XAML file that we created earlier, so what we really need to do is hide it once the image is downloaded. We will do this by controlling the IsVisibleProperty property (the property is actually named IsVisibleProperty) of the loadingLabel control by setting a binding to the IsLoading property of the image. Any time the IsLoading property is changed on the image, the binding changes the IsVisible property on the label. This is a nice fire-and-forget approach.
Let's add the code needed to control the loadingLabel control, as follows:
- Open the Swiper.xaml.cs code-behind file.
- Add the following code marked in bold to the constructor:
public SwiperControl()
{
InitializeComponent();
var picture = new Picture();
descriptionLabel.Text = picture.Description;
image.Source = new UriImageSource() { Uri = picture.Uri };
loadingLabel...