Monday, April 15, 2013

Iterate through Dictionary Entries in Merged Dictionaries

Just a quick post to show you how to iterate through resource dictionary entries when using merged resource dictionaries. It is fairly straight forward. I came across someone wondering how to do this, so I thought I’d share. You simply iterate through all your merged dictionaries and then iterate through each dictionary entry in the dictionary. Here is the code below.

foreach (ResourceDictionary dict in Application.Current.Resources.MergedDictionaries)
{
foreach (DictionaryEntry entry in dict)
{
//Process entry

}
}



Hope this helps.



No comments:

Post a Comment