[英]local bitmapimage(windows phone)
I am trying to convey the path for <Image x:Name="FlagImage" Stretch="None" />
, but when I run the application image is not displayed. 我试图传达
<Image x:Name="FlagImage" Stretch="None" />
的路径,但是当我运行应用程序时,图像不会显示。
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg"));
If I change the path to the URL the image is displayed 如果我更改URL的路径,则会显示图像
FlagImage.Source = new BitmapImage(new Uri("http://www.charlespetzold.com/Media/HelloWP7.jpg"));
This Code work too: 本守则也有效:
<Image Source="/images/sky.jpg"/>
you have initialize your bitmapimage urisource by setting its path to relative..like this 你通过设置它的相对路径来初始化你的bitmapimage urisource。就像这样
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg", UriKind.Relative));
hope it helps you.. 希望它可以帮助你..
I understand. 我明白。 It is necessary to add UriKind.Relative
有必要添加UriKind.Relative
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg", UriKind.Relative));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.