【问题标题】:FFImageLoading ErrorCommand invokes all instancesFFImageLoading ErrorCommand 调用所有实例
【发布时间】:2017-07-25 21:17:58
【问题描述】:

我正在尝试仅使用 XAML 和视图模型在 ListView 中使用 FFImageLoading。对于列表中的每个项目,我都有一个模型,我想在图像无法加载和更新与同一模型中的图像关联的标签时进行陷阱。

<ffimageloading:CachedImage
        DownsampleToViewSize="true"
        RetryCount="0"
        ErrorCommand="{Binding ImageLoadError}"
        IsVisible="{Binding HasAttachement}"
        Source="{Binding Attachment}">
</ffimageloading:CachedImage>

我认为添加一个绑定在我的模型中的 ErrorCommand 处理程序会起作用,除非该命令正在为我的模型的每个实例调用,而不仅仅是图像加载失败的实例

ImageLoadError = new Command((e) =>
{
   Debug.WriteLine($"Image load error Text is {Text}");
});

我的模型的每个实例都会调用上述命令处理程序,而不仅仅是附加到失败图像的实例。

如何才能将加载错误通知仅发送到与图像关联的模型实例?

【问题讨论】:

    标签: xamarin.android xamarin.forms ffimageloading


    【解决方案1】:

    您可以在 Events 部分 (FFImaleLoading Events) 的 FFImageLoading Wiki/文档中看到,有一个“错误”事件可供您收听。

    错误

    在每次图像加载错误后发生。返回:异常

    尝试订阅此事件,它应该只返回那些无法加载的实例。

    【讨论】:

      猜你喜欢
      • 2022-11-29
      • 1970-01-01
      • 1970-01-01
      • 2021-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-02
      相关资源
      最近更新 更多