/// <summary> /// Initializes the style resource loading process. Has to be called before /// <see cref="LoadAllStyleResources"/> is called. /// </summary> public void InitializeStyleResourceLoading() { // We need to initialize our _localStyleResources before loading the style resource files, // because the elements in the resource files sometimes also access style resources from lower // priority skin resource styles. // The opposite is also possible: a lower priority skin resource might depend on a style file which is // overridden here. // So the initialization is done in all resources of the style resource chain BEFORE // loading the dependency tree of resources. if (_inheritedSkinResources != null) { _inheritedSkinResources.InitializeStyleResourceLoading(); } if (IsStylesInitialized) { throw new IllegalCallException("SkinResources '{0}' are already prepared", this); } CheckResourcesInitialized(); _localStyleResources = new ResourceDictionary(); // Collect all style resources to be loaded _pendingStyleResources = new Dictionary <string, PendingResource>(); foreach (KeyValuePair <string, string> resource in GetResourceFilePaths( "^" + STYLES_DIRECTORY + "\\\\.*\\.xaml$", false)) { _pendingStyleResources[resource.Key] = new PendingResource(resource.Value); } MergeLanguageResources(); }
public void InstallSkinResources(SkinResources skinResources) { // Setup the resource chain and use the default skin as last fallback skinResources.SetupResourceChain(_skins, DefaultSkin); // Initialize SkinContext with new resource bundle SkinContext.SkinResources = skinResources; skinResources.InitializeStyleResourceLoading(); // Initializes the resource file dictionary Fonts.FontManager.Load(skinResources); // Needs an initialized resource file dictionary - loads font files skinResources.LoadAllStyleResources(); // Needs the FontManager // Notify others that we loaded a new skin or theme SkinResourcesMessaging.SendSkinResourcesMessage(SkinResourcesMessaging.MessageType.SkinOrThemeChanged); }