Sorting.
You can list all BAML files (compiled XAML) as follows:
var resourcesName = assembly.GetName().Name + ".g"; var manager = new System.Resources.ResourceManager(resourcesName, assembly); var resourceSet = manager.GetResourceSet(CultureInfo.CurrentUICulture, true, true); var allXamlFiles = from entry in resourceSet.OfType<DictionaryEntry>() let fileName = (string)entry.Key where fileName.EndsWith(".baml") select fileName.Substring(0, fileName.Length-5) + ".xaml";
It is not possible to know which ones are ResourceDictionaries and which other XAMLs such as Windows or UserControls are without loading them. So the answer to your direct question is “no,” if you don't download every XAML you find to check if it is a ResourceDictionary. It will be very slow.
On the other hand, if you want to use the naming scheme for your ResourceDictionaries, you can list all the BAMLs in your assembly and choose, depending on your naming scheme, and hope that they are ResourceDictionaries. Just add the where clause in the above query.
Therefore, the answer is "kind of."
source share