Question

I have strange bug with showing image in silverlight. The problem to show list of images that configured in xml file and this xml downloaded from server by WebClient type.

WebClient client = new WebClient();
            client.AllowReadStreamBuffering = true;
            client.OpenReadAsync(new Uri(path, UriKind.Relative), new GalleryUserState() {Gallery=gallery, PathToXml = path });
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(request_for_Gallery_Completed);

after xml downloaded and images retrieved from xml i have strange bug:

I add images to stackpanel dynamically. But images not always shown! Some times image load fails:

    curImage.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(curImage_ImageFailed);
 void curImage_ImageFailed(object sender, ExceptionRoutedEventArgs e)
   {
   }

Exception:

ErrorException = {System.Exception: AG_E_NETWORK_ERROR}

When browser refreshed other image load fails(image list is the same!). The same list with images that i configure in assembly (xap) always working fine.

Its looks like problem with WebClient or something like that. What that can be???

Was it helpful?

Solution

Try setting the UriKind, that might help.

UriKind.RelativeOrAbsolute

OTHER TIPS

load it like this:
/[YOUR_PROJECT_ASSEMPLY_NAME];component/[Path_to_images]/[your_image]

sample:
/System.Windows.Controls.Data.RIADataFilter.Control;component/Images/Plus.png

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top