Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Binding Image.Source to String Property Fails on iOS

$
0
0

I have the following code (profileImage is an XF Image object), which sets up a binding to a property (StaffProfileImageUrl) of type string. I should note this is inside a custom ViewCell used in a listview, but that shouldn't make any difference.

        profileImage.SetBinding(Image.SourceProperty, new Binding("StaffProfileImageUrl"));

On WP this works fine, image is downloaded and displayed ok. On iOS (the simulator, can't use a real device at the moment) it crashes with the unhandled exception;

System.InvalidCastException: Value is not a convertible object: System.String to Xamarin.Forms.ImageSource

I have been able to work around this by implementing my own converter and manually adding it on the binding, but based the Xamarin help (http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/images/) there is supposed to be implicit conversion for strings containing urls. The url in question is an https one, but I also tried a different url using regular http and it failed too. Both urls worked ok with the same code on WP, and both pasted into a browser address bar return an image, so I don't think the problem is with the url/image itself.

Anyone got any ideas why this doesn't work the way I expect?
Thanks.

Troy


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>