예제 #1
0
        /// <summary>
        /// Called Theme property when changed.
        /// Implements the logic that applys the new Theme
        /// </summary>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        public virtual void OnThemeChanged(Theme oldValue, Theme newValue)
        {
            var resources = Application.Current.Resources;

            resources.Clear();
            resources.MergedDictionaries.Clear();
            if (oldValue != null)
            {
                var resourceDictionaryToRemove =
                    resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldValue.GetResourceUri());
                if (resourceDictionaryToRemove != null)
                {
                    resources.MergedDictionaries.Remove(resourceDictionaryToRemove);
                }
            }
            if (newValue != null)
            {
                resources.MergedDictionaries.Add(new ResourceDictionary {
                    Source = newValue.GetResourceUri()
                });
            }

            _mainWindow?.DockingManager?.OnThemeChanged(oldValue, newValue);
            _mainWindow?.OnThemeChanged(oldValue, newValue);

            ToolBarHostViewModel.OnThemeChanged(oldValue, newValue);
        }
 public CustomizeDialog(ToolBarHostViewModel toolBarViewModel)
 {
     InitializeComponent();
     _toolBarHostViewModel = toolBarViewModel;
     Loaded += CustomizeDialog_Loaded;
 }
 public ToolBarHostControl()
 {
     InitializeComponent();
     Instance = this;
     DataContext = new ToolBarHostViewModel(this);
 }