gpt4 book ai didi

wpf - 本地 HTML 文件 - WebBrowser - Windows phone 7

转载 作者:行者123 更新时间:2023-12-02 02:21:19 24 4
gpt4 key购买 nike

我需要有关在 Windows Phone 7 应用程序的网络浏览器中显示 HTML 文件的帮助。

我的 wpf-silverlight 项目中有一个 html 文件作为资源。现在,当用户单击我的应用程序中的“帮助”按钮时,我需要在网络浏览器中显示此 HTML。

Here is the code, which is giving me an error -

webBrowser1.Navigate(new Uri("AppHelp.html",UriKind.Relative))

But, if i use this code, It's loading fine

webBrowser1.Navigate(new Uri("http://mywebsite.com/AppHelp.html",UriKind.Relative))

请帮忙!

我现在已经像这样更改了代码,但现在我收到了这个错误:无效的 URI:端口用“:”发出信号但无法解析。

   Uri uri = new Uri(@"pack://application:AppHelp.html", UriKind.Absolute);
Stream stream = Application.GetResourceStream(uri).Stream;
using (StreamReader reader = new StreamReader(stream))
{
// Navigate to HTML document string
this.webBrowser1.NavigateToString(reader.ReadToEnd());
}

最佳答案

您可以通过获取 html 文件的内容并将其作为此方法的参数来使用 Web 浏览器对象的 NavigateToString 方法。

http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.navigatetostring.aspx

sample 位于:http://blogs.msdn.com/b/mikeormond/archive/2010/12/16/displaying-html-content-in-windows-phone-7.aspx

关于wpf - 本地 HTML 文件 - WebBrowser - Windows phone 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8044528/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com