In my XAML, I have:
<Image Height="150" HorizontalAlignment="Left" Margin="0,4,0,0" Name="imgLogo" Stretch="Fill" VerticalAlignment="Top" Width="417" />
<Image Height="343" HorizontalAlignment="Left" Margin="0,155,0,0" Name="imgPhoto" Stretch="Fill" VerticalAlignment="Top" Width="417" />
In the C# code behind, I have:
WebClient wcForLogo = new WebClient();
wcForLogo.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wcForLogo_DownloadStringCompleted);
wcForLogo.DownloadStringAsync(new Uri("http://mySite/logo.gif"));
WebClient wcForPhoto = new WebClient();
wcForPhoto.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wcForPhoto_DownloadStringCompleted);
wcForPhoto.DownloadStringAsync(new Uri("http://mySite/photo.jpg"));
But now I don't know how to catch the image and post it in the XAML controls I built.
2 questions:
- Is there a way to copy the e.Result directly to the Image controls, or should I cache the image and use the cache as the source, or should I save the image to the isolated storage and then use that as the source, then delete the image when I'm done with it? Whichever case, could you please show me how with code?
- Are GIF's and JPG's dealt with differently? If so, can you show me the 2 different ways?