inherits from the asbstract class MvxAndroidTargetBinding and implements the SetValueImpl method<\/strong> which will set the value (provided as an arg) to the target element (provided as an arg too). <\/p>\nIn our case, I use Picasso to the bitmap on an ImageView :
\n[csharp]
\npublic class ImageUrlToLoadBinding : MvxAndroidTargetBinding
\n{
\n public ImageUrlToLoadBinding(View target) : base(target) { }<\/p>\n
public int PlaceHolderToUse { get; set; }<\/p>\n
protected override void SetValueImpl(object target, object value)
\n {
\n var imageView = (ImageView)target;
\n Picasso.With(imageView.Context)
\n .Load(value as string)
\n .Into(imageView);
\n }<\/p>\n
public override Type TargetType => typeof(string);
\n}
\n[\/csharp]<\/p>\n
Registering the target binding<\/h4>\n
In your Setup class, you have to register this custom binding using the name you want. This name will be the one used as a Target in your MvxBind attributes. To do this, you have to override the FillTargetFactories method<\/strong>. <\/p>\nIn our case, I use “PosterImageUrlToLoad” as a key :
\n[csharp]
\nprotected override void FillTargetFactories
\n (IMvxTargetBindingFactoryRegistry registry)
\n{
\n \/\/ register custom binding here
\n registry.RegisterCustomBindingFactory<View>
\n ("ImageUrlToLoad", v => new ImageUrlToLoadBinding(v));<\/p>\n
base.FillTargetFactories(registry);
\n}
\n[\/csharp]<\/p>\n
Using the target binding<\/h4>\n
This is the easiest part because it’s a casual binding simpley using your “name” as a target. I removed all the other attributes in this example :
\n[xml]<ImageView
\n local:MvxBind="ImageUrlToLoad ImageUrlManager.FinalImageUrl"
\n \/>[\/xml]<\/p>\n
Happy coding !<\/p>\n","protected":false},"excerpt":{"rendered":"
Picasso is a great open-source SDK which let you display images efficiently on Android. I wanted to use it in my MvvmCross app because it really helps you having great display performances especially on list.…<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1612"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=1612"}],"version-history":[{"count":15,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1612\/revisions"}],"predecessor-version":[{"id":1627,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1612\/revisions\/1627"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=1612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=1612"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=1612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}