今天被几个Uri搞晕,记录在案,备忘:
1. ApplicationBarIconButton 的Icon Uri: 所引用的Image的Build Action属性必须是"Content"
The URI must point to a file in the application directory. When adding an image file to an project using Windows Phone Developer Tools, you must set the Build Action property to “Content”. Using the default value “Resource” will not allow the image to be accessed or displayed. - from msdn
且Uri开头须使用反斜杠:
2. WebBrower控件显示本地Html文件内容,使用如下代码:
其中本地文件help.txt的Build Action属性必须为"Content", 但是!但是!Uri开头不能使用反斜杠
A relative URI that identifies the resource file to be loaded. The URI is relative to the application package and does not need a leading forward slash
from msdn

本文介绍了在Windows Phone应用程序中正确使用Uri的方法。包括ApplicationBarIconButton的IconUri设置需指向应用目录下的文件,并确保BuildAction属性设为Content及Uri以反斜杠开头;而WebBrowser控件加载本地Html文件时,Uri则不应包含前导斜杠。
2151

被折叠的 条评论
为什么被折叠?



