Binding Image Control to URI in WP7
I ham developing an application for WP7 and i am having a strange problem with Image control, it does not show the image it is binded to.
I have tryed it in so many ways but event this way (the most naive one) does not work:
In the xaml I have an Image control named img and this is what I h开发者_StackOverflowave done in the code behind
public MainPage() { InitializeComponent(); img.Source = new BitmapImage(new Uri (@"http://img11.imageshack.us/img11/5365/photovnj.jpg", UriKind.Absolute)); } </code>
It seems to simple not to work... Please help!
This code works fine for me presuming you have img
declared as an Image
in your xaml.
If not, I'd suggest you have a connection problem from your app running in the emulator or device to the internet.
This is the code I wrote.
image1.Source = new BitmapImage(new Uri(@"http://img11.imageshack.us/img11/5365/photovnj.jpg", UriKind.Absolute));
精彩评论