好的,图像位于“项目内部”的文件夹中,构建操作是资源。我的问题是如何将这些图标放在组合框中?
我认为这不是重复,因为我进行了搜索,只查找文件夹未嵌入项目的结果。
这是我的代码:(我从搜索中得到了这个,但我忘记了网站)
List<object> items = new List<object>();
var assembly = Assembly.GetExecutingAssembly();
var resourcesName = assembly.GetName().Name + ".g.resources";
var stream = assembly.GetManifestResourceStream(resourcesName);
var resourceReader = new ResourceReader(stream);
foreach(DictionaryEntry item in resourceReader)
{
items.Add(item.Value);
}
comboBox.ItemsSource = items;
//it's working but this is what I get
icons/bbinq.ico
icons/bbt.ico
icons/begr.ico
icons/logo 1.ico
icons/logo.ico
icons/mepv1.ico
icons/mepv2.ico
icons/sbtm.ico
//what I need is like this (case sensitive also)
BBINQ.ico
BBT.ICO
BEGR.ico
LOGO 1.ICO
LOGO.ICO
MEPV1.ico
MEPV2.ico
SBTM.ICO