views:

498

answers:

1

Hi, I'm making a silverlight app that when the user does a mouse-over some tab bars, he/she will see a preview of the page it will link to. The reason for this preview is that just having a visual miniature of the page is often enough to make the desicion for the user. How do I in Silverlight make a control that simply displays a webpage, preferably scaled down?

Cheers

Nik

+2  A: 

As you are probably aware, there are some issues relating to crossing domain boundaries in Silverlight. Issues that have been discussed on stack overflow for example.

This is relevant because generally you can't request web resources in other domains which you'd need to do here.

One way I've seen to get around this is to use a web service that doesn't have the same limitation. So you can create a web service that exposes a byte[] of the image and have the web service do the calls to retrieve the image and send it back to Silverlight.

Once you've got the image byte[] you can read that in an asynchronous call, and set the image source like this.

BitmapImage thumb;
using (MemoryStream stream = new MemoryStream(imgArray))
{
    thumb = new BitmapImage();
    thumb.SetSource(stream);
}

The other issue is how to generate the thumbnail, for that you can google, there are some projects that show you how and some public web services that do it for you. Amazon's is one such example.

TreeUK
Thank you very much for pointing that out and providing these work around suggestions. I was expecting Silverlight to have something similar to the iPhoneSDK's UIWebView that hooked into the supported browsers. Cheers -Nik
niklassaers-vc