We do this with a converter. Thus, the binding is performed on (for example) a logical value. If it is true, the converter returns image 1, and if the value is false, it returns image 2.
Converter (in Core-Project):
public class MyIconValueConverter : MvxValueConverter<bool, string> { protected override string Convert(bool value, Type targetType, object parameter, CultureInfo culture) { if(value) { return "res:ImgMsg_Normal"; } else { return "res:ImgMsg_Grey"; } } }
And the binding in your file:
<Mvx.MvxImageView local:MvxBind="ImageUrl MyBoolProperty, Converter=MyIcon" />
Using the above code, we dynamically change the icon in the list, which shows different elements. The icon depends on the property of the item in the list.
source share