如何在WP7的WebBrowser控件中读取现有的html文件?如何在WP7的WebBrowser控件中读取现有的html文件?
我曾尝试:
流stream = Assembly.GetExecutingAssembly()GetManifestResourceStream( “abc.htm”); StreamReader reader = new StreamReader(stream); string html = reader.ReadToEnd(); Browser.NavigateToString(html);
Browser.Navigate(new Uri(“abc.htm”,UriKind.Relative));
var rs = Application.GetResourceStream(new Uri(“abc.htm”,UriKind.Relative)); StreamReader sr = new StreamReader(rs.Stream); string html = sr.ReadToEnd(); Browser.NavigateToString(html);
所有这三个不工作。方法1和3给出NullReferenceException,因为流返回null,基本上它不读取我的html文件。
这里有什么问题?我该如何解决它?
对不起 - 我在哪里检查? – Sri
选择HTML文件并查看其在Visual Studio中的属性(通常位于VS的右下角)。有一个部分说'生成行动'。将其设置为“内容”。 – keyboardP
谢谢!是的,我看到设置为“内容”。仍然没有工作:( – Sri