【问题标题】:FFimageLoading NugetPackage for Xamarin MVVMCross 4.4.0Xamarin MVVMCross 4.4.0 的 FFimageLoading NugetPackage
【发布时间】:2016-11-29 14:19:33
【问题描述】:

正如question 中所述,我需要使用Xamarin.FormsMVVMCross 4.4.0 从Url 加载图像。

我被指示在那个问题中使用FFimageLoading package,但它不起作用,搜索后我发现 FFimageLoading 库有这个 axml 标签:

<ffimageloading.cross.MvxImageLoadingView/>

我有一个 MvxListView 并且在每个 ListItem 中我需要显示来自 Url 的图像,但是因为 Xamarin.formsMvx.MvximageView ImageUrl 使用相同依赖项的不同版本,所以没有办法。

我有一个带有 String imgUrl 的 Model 类,一个带有 observableCollection&lt;myclass&gt; items 的 viewModel 具有 imgUrl (items.imgUrl),但是当我尝试在 axml 中绑定时它不起作用。

<ffimageloading.cross.MvxImageLoadingView
            android:layout_width="100dp"
        android:layout_height="100dp"
            local:MvxBind="Source imgUrl" />

【问题讨论】:

标签: c# xamarin xamarin.forms mvvmcross ffimageloading


【解决方案1】:

首先:您正在使用Xamarin.Forms,但您也在谈论您的android项目中的axml-view。我知道,有时别无他法,但尽量将你的 UI 放在你的 shared/pcl 项目中(因为这是使用 Xamarin.Forms 的主要案例之一)。

我从未使用过插件的 MvvmCross 视图 (MvxImageLoadingView),但我认为您应该使用 UriImageSource 作为 imgUrl 属性的类型,而不仅仅是字符串(查看 this page in the documentation) .

【讨论】:

  • 我得到 'Xamarin.Forms.UriImageSource' 无法转换为类型 'System.Nullable`1[FFImageLoading.Work.ImageSource]'。所以我将它转换为 FFImageLoading.Work.ImageSource 但是.... System.InvalidCastException: Specified cast is not valid.
【解决方案2】:

不要在 2016 年 2 月 12 日将 xamarin.forms 与 mvvmcross4.4.0 一起使用。

xamarin 表单依赖于 android.support.appcompat.v4/v7 的旧版本,因此我无法使用 Mvx.MvxImageView 显示来自 Url 的图像,并且实现导航菜单非常困难。

这是我对我创建的这个问题的结论。我将删除我的解决方案的 xamarin 形式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-06
    • 2018-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多