示例#1
0
        private void cmbTheme_SelectedItemChanged(object sender, PropertyChangedEventArgs <object> e)
        {
            C1Theme ribbonTheme = null;
            var     theme       = C1ThemeFactory.GetTheme((C1AvailableThemes)cmbTheme.SelectedItem);

            C1Theme.ApplyTheme(LayoutRoot, theme);

            var adornerLayer = AdornerLayer.GetAdornerLayer(LayoutRoot);

            if (adornerLayer != null)
            {
                // this will aplly theme to everything displayed in adorner, including any C1Window instances
                C1Theme.ApplyTheme(adornerLayer, theme);
            }
            //gallery.CurrentTheme = theme;

            SetRibbonTheme(ribbonTheme, (C1AvailableThemes)cmbTheme.SelectedItem);

            // Application.Current.Resources.MergedDictionaries.Clear();
            Application.Current.Resources.MergedDictionaries.Add(theme.GetNewResourceDictionary());
            if (ribbonTheme != null)
            {
                Application.Current.Resources.MergedDictionaries.Add(ribbonTheme.GetNewResourceDictionary());
            }
            // ribbon.ApplicationMenu.Background = this.Background;
        }
示例#2
0
        private void SetTheme()
        {
            var theme = C1ThemeFactory.GetTheme(C1AvailableThemes.Office2016Colorful);

            C1Theme.ApplyTheme(LayoutRoot, theme);

            var adornerLayer = AdornerLayer.GetAdornerLayer(LayoutRoot);

            if (adornerLayer != null)
            {
                // this will aplly theme to everything displayed in adorner, including any C1Window instances
                C1Theme.ApplyTheme(adornerLayer, theme);
            }
        }