我正在尝试使用以下代码在WPF中运行时加载图像:
_image = new Image();
BitmapImage src = new BitmapImage();
src.BeginInit();
src.UriSource = new Uri(@"pack://application:,,,/images/tagimages/placeholder.png", UriKind.Absolute);
src.CacheOption = BitmapCacheOption.OnLoad;
src.EndInit();
_image.Source = src;
_image.Stretch = Stretch.None;
在我的项目中,我有一个名为images的文件夹和该文件夹下的一个子文件夹tagimages,其中包含了placeholder.png。当我运行此代码时,我收到以下错误信息:"Cannot locate resource 'images/tagimages/placeholder.png'"。我做错了什么?