Exemplo n.º 1
0
        void ThemeSelector_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            var selectedItem   = (RadComboBoxItem)((RadComboBox)sender).SelectedItem;
            var themeNameParts = ((string)selectedItem.Content).Split('_');
            var themeName      = themeNameParts[0];
            var themeVariation = string.Empty;

            MergeResourceDictionaries(themeName);

            if (themeNameParts.Length > 1)
            {
                switch (themeName)
                {
                case "VisualStudio2013":
                    VisualStudio2013Palette.LoadPreset((VisualStudio2013Palette.ColorVariation)GetPresetEnum(typeof(VisualStudio2013Palette.ColorVariation), themeNameParts[1]));
                    break;

                case "Office2013":
                    Office2013Palette.LoadPreset((Office2013Palette.ColorVariation)GetPresetEnum(typeof(Office2013Palette.ColorVariation), themeNameParts[1]));
                    break;

                case "Green":
                    GreenPalette.LoadPreset((GreenPalette.ColorVariation)GetPresetEnum(typeof(GreenPalette.ColorVariation), themeNameParts[1]));
                    break;
                }

                themeVariation = themeNameParts[1];
            }

            this.SetLayoutBackground(themeName, themeVariation);
        }
Exemplo n.º 2
0
 private void Green_Light_Checked(object sender, RoutedEventArgs e)
 {
     Application.Current.Resources.MergedDictionaries.Clear();
     Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
     {
         Source = new Uri("/Telerik.Windows.Themes.Green;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
     });
     Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
     {
         Source = new Uri("/Telerik.Windows.Themes.Green;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
     });
     GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light);
     this.container.Background = new SolidColorBrush(Colors.White);
 }
Exemplo n.º 3
0
        public string setLightOrDark(string themeName)
        {
            if (themeName.Contains("Office2013"))
            {
                switch (themeName)
                {
                case "Office2013_LightGray":
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.LightGray);
                    break;

                case "Office2013_DarkGray":
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.DarkGray);
                    break;

                default:
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.White);
                    break;
                }
                return("Office2013");
            }
            if (themeName.Contains("VisualStudio2013"))
            {
                switch (themeName)
                {
                case "VisualStudio2013_Blue":
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Blue);
                    break;

                case "VisualStudio2013_Dark":
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Dark);
                    break;

                default:
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Light);
                    break;
                }
                return("VisualStudio2013");
            }
            if (themeName.Contains("Green"))
            {
                switch (themeName)
                {
                case "Green_Light":
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light);
                    break;

                case "Green_Dark":
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark);
                    break;

                default:
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark);
                    break;
                }
                return("Green");
            }
            if (themeName.Contains("Fluent"))
            {
                switch (themeName)
                {
                case "Fluent_Dark":
                    FluentPalette.LoadPreset(FluentPalette.ColorVariation.Dark);
                    break;

                default:
                    FluentPalette.LoadPreset(FluentPalette.ColorVariation.Light);
                    break;
                }
                return("Fluent");
            }
            if (themeName.Contains("Crystal"))
            {
                if (themeName.Contains("Crystal_Dark"))
                {
                    CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Dark);
                }
                else
                {
                    CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Light);
                }
                return("Crystal");
            }
            return(themeName);
        }
Exemplo n.º 4
0
        private string GetDefaultThemeNameAndSetColorVariation(string themeName)
        {
            // Office2013 Theme
            if (themeName.Contains(ApplicationThemeManager.Office2013DefaultThemeName))
            {
                switch (themeName)
                {
                case (ApplicationThemeManager.Office2013LightGrayThemeName):
                {
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.LightGray);
                }
                break;

                case (ApplicationThemeManager.Office2013DarkGrayThemeName):
                {
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.DarkGray);
                }
                break;

                default:
                {
                    Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.White);
                }
                break;
                }

                return(ApplicationThemeManager.Office2013DefaultThemeName);
            }

            // VisualStudio2013 Theme
            if (themeName.Contains(ApplicationThemeManager.VisualStudio2013DefaultThemeName))
            {
                switch (themeName)
                {
                case (ApplicationThemeManager.VisualStudio2013BlueThemeName):
                {
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Blue);
                }
                break;

                case (ApplicationThemeManager.VisualStudio2013DarkThemeName):
                {
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Dark);
                }
                break;

                default:
                {
                    VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Light);
                }
                break;
                }

                return(ApplicationThemeManager.VisualStudio2013DefaultThemeName);
            }

            // Green Theme
            if (themeName.Contains(ApplicationThemeManager.GreenDefaultThemeName))
            {
                switch (themeName)
                {
                case (ApplicationThemeManager.GreenLightThemeName):
                {
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light);
                }
                break;

                case (ApplicationThemeManager.GreenDarkThemeName):
                {
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark);
                }
                break;

                default:
                {
                    GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark);
                }
                break;
                }

                return(ApplicationThemeManager.GreenDefaultThemeName);
            }

            // Fluent Theme
            if (themeName.Contains(ApplicationThemeManager.FluentDefaultThemeName))
            {
                switch (themeName)
                {
                case (ApplicationThemeManager.FluentDarkThemeName):
                {
                    FluentPalette.LoadPreset(FluentPalette.ColorVariation.Dark);
                }
                break;

                default:
                {
                    FluentPalette.LoadPreset(FluentPalette.ColorVariation.Light);
                }
                break;
                }

                return(ApplicationThemeManager.FluentDefaultThemeName);
            }

            // Crystal Theme
            if (themeName.Contains(ApplicationThemeManager.CrystalDefaultThemeName))
            {
                switch (themeName)
                {
                case (ApplicationThemeManager.CrystalDarkThemeName):
                {
                    CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Dark);
                }
                break;

                default:
                {
                    CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Light);
                }
                break;
                }

                return(ApplicationThemeManager.CrystalDefaultThemeName);
            }

            return(themeName);
        }