Nicolai
Nicolai

Reputation: 2915

Reading a remote image file

My problem seems simple, but for some reason, I can't quite seem to fix it. I need to set an image, in silverlight, based on a remote image file. I am aware, that Silverlight can not read the clients filesystem, but what about the servers filesystem? Or another remote shared filesystem?

How do I get it to read a .png file, that is stored in a public location, and set my Image control to it?

Upvotes: 0

Views: 363

Answers (1)

ChrisF
ChrisF

Reputation: 137148

This should work:

<Image Source="http://example.com/image.png" />

You should also be able to set the Source in the C# code as well via the following code:

BitmapImage bmi = new BitmapImage(new Uri("http://example.com/image.png", UriKind.Absolute));
image.Source = bmi;

This assumes that you have permission to read the image at that location.

Upvotes: 1

Related Questions