MvvmCross Native controls - luberda-molinet/FFImageLoading GitHub Wiki

MvxCachedImageView allows you to easily integrate with MvvmCross.

Source available here

Samples available here

This helper is included in the Nuget packages.

iOS Example


_imageControl = new MvxCachedImageView();
ContentView.AddSubview(_imageControl);
ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
SetNeedsUpdateConstraints();

this.DelayBind(
    () =>
    {
        _imageControl.LoadingPlaceholderImagePath = "res:place.jpg";
        _imageControl.ErrorPlaceholderImagePath = "res:place.jpg";
        _imageControl.TransformPlaceholders = true;

        var set = this.CreateBindingSet<CustomTableViewCell, Image>();
        set.Bind(_imageControl).For(v => v.DownsampleWidth).To(vm => vm.DownsampleWidth);
        set.Bind(_imageControl).For(v => v.Transformations).To(vm => vm.Transformations);
        set.Bind(_imageControl).For(v => v.ImagePath).To(vm => vm.Url);
        set.Apply();
    }
);

Android Example


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <ffimageloading.cross.MvxCachedImageView
        android:layout_width="match_parent"
        android:layout_height="100dp"
        local:MvxBind="LoadingPlaceholderImagePath 'res:place.jpg'; ErrorPlaceholderImagePath 'res:place.jpg'; Transformations Transformations; DownsampleWidth DownsampleWidth; ImagePath Url" />
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        local:MvxBind="Text Url" />
</LinearLayout>