该代码适用于普通,但不适用于FFImageLoading。ActivityIndicator未显示。。。我做错了什么?
<ContentPage.Content>
<StackLayout>
<local:PinchPanContainer>
<local:PinchPanContainer.Content HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ffimageloading:CachedImage RetryCount="5" RetryDelay="1" CacheDuration="1" x:Name="MyImage" HorizontalOptions="Fill" VerticalOptions="CenterAndExpand" DownsampleToViewSize="False"></ffimageloading:CachedImage>
</local:PinchPanContainer.Content>
</local:PinchPanContainer>
<ActivityIndicator BindingContext="{x:Reference MyImage}" IsRunning="{Binding CachedImage.IsLoading}" IsVisible="{Binding CachedImage.IsLoading}"/>
</StackLayout>
</ContentPage.Content>
您使用的绑定路径不正确,应该是IsLoading
而不是CachedImage.IsLoading
:
<StackLayout>
<ffimageloading:CachedImage Source="http://img1.wikia.nocookie.net/__cb20101219155130/uncyclopedia/images/7/70/Facebooklogin.png" LoadingDelay="2000" RetryCount="5" RetryDelay="1" CacheDuration="1" x:Name="MyImage" HorizontalOptions="Fill" VerticalOptions="CenterAndExpand" DownsampleToViewSize="False"></ffimageloading:CachedImage>
<ActivityIndicator BindingContext="{x:Reference MyImage}" Color="Red" IsRunning="{Binding IsLoading}" IsVisible="{Binding IsLoading}"/>
</StackLayout>
参考:数据绑定基础