views:

625

answers:

1

I'm trying to show some images on my silverlight application whenever user wants to. The images are in a folder in my silverlight project and I don't want the user to download all of them when he/she loads the web page for the first time.

I have tried the OpenReadAsync method with a relative address to the image file which is in a folder named images and its Build Action is set to Content and also its "Copy to Output Direcoty" property is set to Always.

But I get the following exception in the OpenReadCompleted event: The URI prefix is not recognized.

Here is the code I used:

Dim webClient As New WebClient
AddHandler webClient.OpenReadCompleted, AddressOf webClient_OpenReadCompleted
WebClient.AllowReadStreamBuffering = True
WebClient.OpenReadAsync(New Uri("images/myimage.jpg", UriKind.Relative))

Can anyone tell me how can I solve this problem? Thanks

A: 

To start with take the images out of the silverlight project. You want the images to be in the web project then you can use a normal image tag with an empty source, then when you need to download the image set the source to the uri.

Graeme Bradbury
Does it loads images asynchronously? I want to show a loading animation whenever an image is loading.
Mohammadreza