Yes, you can iterate over resources through loops. For example, using a loop foreach:
foreach (var res in Application.Current.Resources)
{
Console.WriteLine(res);
}
Update:
To get everything ResourceDictionary'iesfrom an external library, you must first load the library and then get ManifestResourceInfo. Let me show you an example:
string address = @"WpfCustomControlLibrary.dll";
List<Stream> bamlStreams = new List<Stream>();
Assembly skinAssembly = Assembly.LoadFrom(address);
string[] resourceDictionaries = skinAssembly.GetManifestResourceNames();
foreach (string resourceName in resourceDictionaries)
{
ManifestResourceInfo info = skinAssembly.GetManifestResourceInfo(resourceName);
if (info.ResourceLocation != ResourceLocation.ContainedInAnotherAssembly)
{
Stream resourceStream = skinAssembly.GetManifestResourceStream(resourceName);
using (ResourceReader reader = new ResourceReader(resourceStream))
{
foreach (DictionaryEntry entry in reader)
{
}
}
}
}
ResourceDictionary reader. , .
, .