Posted 5 years ago by Martin - Blaise - Statistics Netherlands
Version: 18.1.0673
Avatar

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

Comments (1)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

If you are coming from a very old version, the Metro themes were merged into the Shared assembly so that they can be applied by default.  This change occurred back in 2016.1.  The conversion topics for 2016.1 in the documentation have info on that update.

There is no more ThemesMetroThemeCatalog needed.  Going along with that change, the old XP-like Luna themes were moved out into a separate assembly (like there used to be for Metro), and there is a ThemesLunaThemeCatalog class for those.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.