0
我试图从我的文件位置加载图像。图像尺寸为70 * 70;这是一个缩略图。图像不能拉伸,但它仍然没有加载完整的图像
我的图像元素在XAML定义是这样的:
<Image Grid.ColumnSpan="2" Stretch="None" Grid.Row="16" Height="114"
HorizontalAlignment="Left" Name="imgThumbnail"
VerticalAlignment="Top" Width="133"
Grid.RowSpan="3" Grid.Column="2" Margin="28,0,0,0" />
在我的代码后面我用下面的:
foreach (string filePath in filePathList)
{
if (Path.GetFileNameWithoutExtension(filePath).ToLower().Contains(slugName.ToLower()+"_70x70"))
{
if (Path.GetFileNameWithoutExtension(filePath).ToLower().Contains("_70x70"))
{
filePathList_ToBeDeleted.Add(filePath);
imgThumbnail.Stretch = Stretch.None;
imgThumbnail.Source = new BitmapImage(new Uri(filePath));
//image1.Source = filePath.;
}
}
}
Stretch.None
似乎在我的情况下不能正常工作;有没有其他的选择,我在这里确保我的图像不被拉伸,并得到它,因为它是?
目前尚不清楚你想要什么。你说你不希望图像被拉伸,并且它在你的情况下工作。你能给我们一个问题来回答吗? – Akku