从xap文件中加载图片

xaml写法:

<Image x:Name="xImage" Stretch="Uniform" 
Source
="/pic;component/img.jpg" />



c#写法:

xImage.Source = new BitmapImage(new Uri("/pic;component/img.jpg", UriKind.Relative));


其中"/{0};component/{1}"
0为xap程序集的名字
1为tup在xap中的路径.  "img.jpg"在根目录下.  要是有目录"_temp"下的话就应该为   "component/_temp/img.jpg"

原文地址:https://www.cnblogs.com/baobao2010/p/1783022.html