Amit Raz
Amit Raz

Reputation: 5536

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 have 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!

Upvotes: 0

Views: 2274

Answers (1)

Mick N
Mick N

Reputation: 14882

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));

Upvotes: 2

Related Questions