Exemplo n.º 1
0
        private static void LoadTheme()
        {
            // load theme

            //var themefiles = Directory.GetFiles(System.Windows.Forms.Application.StartupPath, "Telerik.WinControls.Themes.TelerikMetroTouch.dll");
            var themefiles = Directory.GetFiles(System.Windows.Forms.Application.StartupPath, "Telerik.WinControls.Themes.VisualStudio2012Light.dll");

            foreach (var theme in themefiles)
            {
                var themeAssembly = Assembly.LoadFile(theme);
                var themeType     = themeAssembly.GetTypes().Where(t => typeof(RadThemeComponentBase).IsAssignableFrom(t)).FirstOrDefault();
                if (themeType != null)
                {
                    RadThemeComponentBase themeObject = (RadThemeComponentBase)Activator.CreateInstance(themeType);
                    if (themeObject != null)
                    {
                        themeObject.Load();
                    }
                }
            }
            var themeList = ThemeRepository.AvailableThemeNames.ToList();

            //ThemeResolutionService.ApplicationThemeName = "TelerikMetroTouch";
            ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Light";
        }
Exemplo n.º 2
0
            public void DynamicThemeLoad()
            {
                // source: https://stackoverflow.com/questions/4393098/how-do-i-switch-themes-in-telerik-winforms/4424735

                var themefiles = Directory.GetFiles(System.Windows.Forms.Application.StartupPath, "Telerik.WinControls.Themes.*.dll");

                foreach (var theme in themefiles)
                {
                    var themeAssembly = Assembly.LoadFile(theme);
                    var themeType     = themeAssembly.GetTypes().Where(t => typeof(RadThemeComponentBase).IsAssignableFrom(t)).FirstOrDefault();
                    if (themeType != null)
                    {
                        RadThemeComponentBase themeObject = (RadThemeComponentBase)Activator.CreateInstance(themeType);
                        if (themeObject != null)
                        {
                            themeObject.Load();
                        }
                    }
                }
                var themeList = ThemeRepository.AvailableThemeNames.ToList();

                themeDropDown.DataSource = themeList;
            }