Silverlight如何内嵌资源,适用于Windows Phone
Silverlight使用资源文件(例如图片和配置文件)有两种方式,第一种使用URL指向网络上的资源,第二种使用内嵌资源。但是在Silverlight for Windows Phone使用图片只能使用内嵌资源的方式,下面讲述在Silverlight下如何内嵌资源。
选择需要内嵌的资源,然后右键选择属性。
Build Action选择Content。Copy to Output Directory选择Do not copy。
重新编译生成xap文件。
把xap文件改名为zip文件。
解压zip文件,发现需要的资源文件已经拷贝到xap文件里面了。
下面是使用内嵌资源的代码。
private const string xmlFile = "Config/SilverRadio.xml";
XDocument xDoc = XDocument.Load(xmlFile);
作者:Jake Lin(Jake's Blog on 博客园)
出处:http://procoder.cnblogs.com
本作品由Jake Lin创作,采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。 任何转载必须保留完整文章,在显要地方显示署名以及原文链接。如您有任何疑问或者授权方面的协商,请给我留言。
出处:http://procoder.cnblogs.com
本作品由Jake Lin创作,采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。 任何转载必须保留完整文章,在显要地方显示署名以及原文链接。如您有任何疑问或者授权方面的协商,请给我留言。