internal void UpdateThemeResources(Theme oldTheme = null)
        {
            if (oldTheme != null)
            {
              if( oldTheme is DictionaryTheme )
              {
                if( currentThemeResourceDictionary != null )
                {
                  Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
                  currentThemeResourceDictionary = null;
                }
              }
              else
              {
                var resourceDictionaryToRemove =
                    Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
                if( resourceDictionaryToRemove != null )
                  Resources.MergedDictionaries.Remove(
                      resourceDictionaryToRemove );
              }
            }

            if (_manager.Theme != null)
            {
              if( _manager.Theme is DictionaryTheme )
              {
                currentThemeResourceDictionary = ( ( DictionaryTheme )_manager.Theme ).ThemeResourceDictionary;
                Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
              }
              else
              {
                Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() });
              }
            }
        }
Beispiel #2
0
		internal void UpdateThemeResources(Theme oldTheme = null)
		{
			if (oldTheme != null)
			{
				var resourceDictionaryToRemove =
					Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri());
				if (resourceDictionaryToRemove != null)
					Resources.MergedDictionaries.Remove(
						resourceDictionaryToRemove);
			}

			if (_host.Manager.Theme != null)
			{
				Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _host.Manager.Theme.GetResourceUri() });
			}
		}