[英]Convert a dynamic BitmapImage to a grayscale BitmapImage in a Windows Phone application
[英]local bitmapimage(windows phone)
我試圖傳達<Image x:Name="FlagImage" Stretch="None" />
的路徑,但是當我運行應用程序時,圖像不會顯示。
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg"));
如果我更改URL的路徑,則會顯示圖像
FlagImage.Source = new BitmapImage(new Uri("http://www.charlespetzold.com/Media/HelloWP7.jpg"));
本守則也有效:
<Image Source="/images/sky.jpg"/>
你通過設置它的相對路徑來初始化你的bitmapimage urisource。就像這樣
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg", UriKind.Relative));
希望它可以幫助你..
我明白。 有必要添加UriKind.Relative
FlagImage.Source = new BitmapImage(new Uri("/images/sky.jpg", UriKind.Relative));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.