我是XAML/WPF的新手,我不知道如何处理这个问题,我花费了太多的时间来解决这个问题,但我无法弄清楚。 我有一个名为Card的类,其中“应该”包含图像的来源。 public class Card
{
public ImageSource image; // this is the only one which doesn't get a value..
}
我也有一个方法的类,
我想将图像源设置为从我的电脑(不在资产中)。 这是我正在试图做到这一点: Uri uri = new Uri(@"D:\Riot Games\about.png", UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
this.image1.Source = imgSource;
我几乎尝试了所有我能找到在互联
如果我执行下面的C#/ WPF代码,tempImage(System.Windows.Controls.Image)将按预期显示图像。 Image tempImage = new Image();
tempImage.Source = layers[layerIndex].LayerImageSource;
// LayerImageSource is of type "ImageSource