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