且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Windows Phone 8的隔离存储中的图像显示到Web浏览器控件中

更新时间:2022-03-14 03:23:24

您可以将隔离存储中的内容加载到使用带有相对于隔离存储"/"的根的Uri的Uri的Navigate方法访问webBrowser控件.

You can load content from your isolated storage into the webBrowser control using the Navigate method with a Uri relative to the root of the isolated storage "/".

例如,假设我创建一个文件夹"WebContent",在我的IsolatedStorage中保存图像文件的位置:Lighthouse.jpg.我将像这样加载此图像:

For example, say I create a folder "WebContent" in my IsolatedStorage in which I save an image file: Lighthouse.jpg.  I would load this image like so:

webBrowser1.Navigate(new Uri("WebContent/Lighthouse.jpg", UriKind.Relative));

另一个选项是将WebBrowser.Base属性设置为"WebContent".然后相对于文件夹"WebContent"指定Uri,如下所示:

Another option is to set the WebBrowser.Base property to "WebContent" then specify the Uri relative to the folder "WebContent", like so:

webBrowser1.Base = "WebContent";
webBrowser1.Navigate(new Uri("Lighthouse.jpg", UriKind.Relative));

如果您要保留多个版本的内容,这将很有用.

This can be useful if you have multiple versions of the content that you want to keep separate.