0
我正在嘗試將本地路徑中的圖像加載到Silverlight圖像控件。這是一個瀏覽器外的應用程序。當我使用流加載圖像時,它總是翻轉過來。從文件流中讀取圖像時翻轉-90
任何想法爲什麼?這僅適用於大圖像。
FileName
這裏給出了本地文件系統的完整路徑,如C:\imageFullPath\image.jpg
。
請幫忙。以下是代碼。
------在模型側------------------------
public BitmapImage DisplayImage
{
get
{
if (!string.IsNullOrWhiteSpace(FileName))
{
var b = new BitmapImage();
b.SetSource(System.IO.File.OpenRead(FileName));
return b;
}
return null;
}
}
------在Silverlight瀏覽側------------------------
<Image Source="{Binding DisplayImage, Mode=TwoWay}" Width="450" Height="250" Margin="0,0,0,0"/>
我看到什麼樣的調試
感謝您的回覆。 發生這種情況只有大圖像不僅僅是這一個,而是每個大圖像。我已經嘗試第一種方法var b = new BitmapImage(new Uri(FileName)); 但這只是返回空圖像。 第二個對我來說不實際,因爲我不得不在模型中決定所有這些,而不是在xaml中。任何其他想法? – AllSpark