Silverlight学习(二)-关于Image控件路径问题

//如果图片被打包在xap文件里,则用这种方式(注意:图片的Build Action属性一定要为Content,这个图片文件会被包含在xap文件中
如上图)
Image.Source = new BitmapImage(new Uri("/Images/close-mousedown.png", UriKind.Relative));
//如果图片在Web工程里,则使用下面这种方式。
Image.Source = new BitmapImage(new Uri("Images/close-mousedown.png", UriKind.Relative));
mark !
浙公网安备 33010602011771号