Visual Studio 2015 不会显示本地网页 (ms-appx ?) [英] Visual Studio 2015 won't display local web page (ms-appx ?)

查看:27
本文介绍了Visual Studio 2015 不会显示本地网页 (ms-appx ?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VS 2015 社区将应用程序转换为作为通用 Windows 应用程序运行.如果我使用工具箱创建一个 webview,我可以输入 "http://www.google.com"来源属性,它会显示谷歌.

I'm converting an app to run as a Universal Windows App using VS 2015 Community. If I create a webview using the toolbox, I can enter "http://www.google.com" into the Source property, and it will display google.

如果我使用 Source 属性上的下拉菜单将 Help.htm 引用为本地资源,则源窗口将显示ms-appx:///Help.htm".同样,如果它在 Assets 中,则会显示ms-appx:///Assets/Help.htm".当我运行该程序时,应该出现 webview 的位置显示您需要一个新应用程序来显示此 ms-appx"并邀请我搜索商店.

If I use the drop down on the Source property to reference (say) Help.htm as a local resource, the source windows displays "ms-appx:///Help.htm". Similarly if it is in Assets, it displays "ms-appx:///Assets/Help.htm". When I run the program, where the webview should appear it displays "You will need a new app to display this ms-appx" and invites me to search the store.

我可以使用非常相似的语法在图像框中显示本地图像,源为ms-appx:///Assets/StoreLogo.png".在这种情况下,Source 属性位于common"组中,而不是miscellaneous"组中,但除此之外看起来几乎相同.

I can display a local image in an image box with very similar syntax, with Source being "ms-appx:///Assets/StoreLogo.png". The Source property in this case is in the "common" group, not "miscellaneous", but apart from that appears virtually identical.

我也不能在 URI 中指定本地路径(尽管我可以再次显示 Google).在两台不同的机器上的行为是相同的.我花了几天时间试图弄清楚发生了什么;有什么建议?

Nor can I specify a local path in a URI (although again I can display Google). Behaviour is identical on two different machines. I have spent several days trying to work out what is going on; any suggestions?

推荐答案

能否请您尝试通过代码加载文件并共享结果?

Can you please try to load file through code and share results?

public MainPage()   
{  
    this.InitializeComponent();  
    mywebview.Source = newUri("ms-appx-web:///Help.htm");  

}  

也试试这个

mywebview.Navigate(newUri("ms-appx-web:///Help.htm")); 

如果以上两个选项都不起作用.请转至下方并分享结果

If both above options doesn't work. Please change to below and share results

mywebview.NavigateToString("<Html><Body><h1>Eureka!!!!<h1><Body></Html>"); 

这篇关于Visual Studio 2015 不会显示本地网页 (ms-appx ?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆