Search code examples
c#androidmvvmcross

Image not appearing in MvxImageView in android app


I am using the MvxImageView in an android app to show the image in a MvxListView . I have saved the image in drawable folder inside Resources folder but the image does not appear in the list . I have done every permutation and combination as given here in the stackoverflow answers . This line works fine now but when these codes

<Mvx.MvxImageView
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_margin="10dp"
    local:MvxBind="ImageUrl 'res:icon1'"/>

Changes to :

<Mvx.MvxImageView
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_margin="10dp"
    local:MvxBind="ImageUrl Path "/>

Where Path is :

ttls.Add(new Title { title = f.Value, Path = "'res:icon1'" });

then no image is appearing .


Solution

  • I think the main problem you are facing is that Path is a reserved name - because of WPF heritage - so you can't use it in the binding expression like that...

    If you really want to use Path as the property name, then this should work:

    <Mvx.MvxImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="10dp"
        local:MvxBind="ImageUrl Path=Path "/>