views:

68

answers:

1

Our Silverlight application needs to show to the user previews of HTML pages it generates dynamically, so we want to use the WebBrowser (or something similar like Telerik's RadHtmlPlaceholder) to show these pages. The problem is that the HTML contains links to other local files such as images, flash objects, CSS and javascript files. The CSS and javascript could be placed inline in the HTML, but I haven't found a way to embed images. Something simple like this just doesn't work:

Creating the HTML file and the image file in the isolated storage is doable, but I can't get the path to the created HTML file to pass on to WebBrowser.Navigate(uri).

Reading the contents of the HTML file and calling WebBrowser.NavigateToString(string) will show the page, but not any linked images or scripts.

Linking to online sources is not an option as the application needs to work offline (i.e. out of browser) and performance would be much better if the images and flash objects were able to be cached locally.

So, is there any way in Silverlight of showing in the WebBrowser control a local HTML file that contains an image from the local file system, or is it impossible?

Thanks, James

A: 

The System.IO functions built into OOB only read and write to the local document directories. As long as everything is in there, you can use that with elevated trust. Other than that using registered COM object with AutomationFactory is the only other way to access files anywhere on the system. file://C:/path to file.html is the URI to display a file from the localfile system.

Jordan