FFImageLoading ErrorCommand 调用所有实例

FFImageLoading ErrorCommand invokes all instances

我正在尝试在 ListView 中仅使用 XAML 和视图模型来使用 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}");
});

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

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

正如您在 FFImageLoading Wiki/Documentation 上看到的 Events 部分 (FFImaleLoading Events) 有一个 'Errors' 事件你可以听。

Error

Occurs after every image loading error. Returns: Exception

尝试订阅这个事件,它应该return只有那些无法加载的实例。