문제

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???

도움이 되었습니까?

해결책

Try setting the UriKind, that might help.

UriKind.RelativeOrAbsolute

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top