【发布时间】:2012-10-28 14:41:44
【问题描述】:
我有一个名为xModule 的模块。我有一个图像,其中标记为embedded resource。
在我尝试过的模块初始化内部:
string stFileName = "SmallIcon.png";
string stAssembly = "xModule"; // That's the full name of the assembly
//img.BeginInit();
Uri uri = new Uri(String.Format(@"/{0};component/Images/{1}", stAssembly , stFileName),
UriKind.Relative);
ImageSource imgSource = new BitmapImage(uri);
在到达ImageSource imgSource =.. 行的断点期间,ImageSource 似乎找不到图像...
为什么?它有什么问题?
我没有收到任何错误,程序集被引用。我在 Xaml 中做了类似的事情,它奏效了。 也用过:VS11、Unity
【问题讨论】: