Well I've looked up several methods to fix this in my Windows Phone 7 app but I can't seem to find anything that works. What confuses me is that I've done something just like this before with no problem, so I'm not sure why it's not working. The code causing me the problem is this:
if (appSettings.Contains("image"))
myImage.Source = (string)appSettings["image"];
else
myImage.Source = "default.jpg";
The error I get is this
Cannot implicitly convert type 'string' to 'System.Windows.Media.ImageSource.
The reason this confuses me is because I did this Twitter app tutorial, in which you bind the image source directly to a string. So what can I do to fix this?
You need to specify an ImageSource instead of a string when doing it from code:
Uri uri = new Uri("...", UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
myImage.Source = imgSource;
Unless I've not found the right part of Scott's post that you're looking at, he is binding image source to a url.
Specificaly,
ImageSource = tweet.Element("user").Element("profile_image_url").Value
Which would be something like
http://a0.twimg.com/profile_images/1158022545/mickn_normal.jpeg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With