
Can you provide me how to access in code the resources of the Metro themes? This was the code, but the new? Metro themes can not be loaded.
ResourceDictionary resources = null;
if (!string.IsNullOrEmpty(selectedTheme)) {
resources = new ResourceDictionary();
try {
var assembly = typeof(SharedThemeCatalog).Assembly;
if (selectedTheme.StartsWith("Office", StringComparison.InvariantCultureIgnoreCase))
assembly = typeof(ThemesOfficeThemeCatalog).Assembly;
resources.Source = ResourceHelper.GetLocationUri(assembly, "Themes/Includes/Assets/" + selectedTheme + ".xaml");
} catch { }
}
return resources;
So i added this line:
// new for Metro
if (selectedTheme.StartsWith("Metro", StringComparison.InvariantCultureIgnoreCase))
assembly = typeof(ThemesMetroThemeCatalog).Assembly;
but it seems the Uri is not correct (or the assembly;))
The theme does work, so i just want to be able to access the resources and keys inside a shared assembly of a selected theme.
The old code works, but not for the new Metro themes. Guess the resources uri is different?
Can you help me?
Greetz Martin